Part Number Hot Search : 
BPC350 Z5261 HBF2C5M 193CJA MC340 T211029 R12KE SPT7710
Product Description
Full Text Search
 

To Download HD64F7047F50 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  to our customers, old company name in catalogs and other documents on april 1 st , 2010, nec electronics corporation merged with renesas technology corporation, and renesas electronics corporation took over all the business of both companies. therefore, although the old company name remains in this document, it is a valid renesas electronics document. we appreciate your understanding. renesas electronics website: http://www.renesas.com april 1 st , 2010 renesas electronics corporation issued by: renesas electronics corporation ( http://www.renesas.com ) send any inquiries to http://www.renesas.com/inquiry .
notice 1. all information included in this document is current as of the date this document is issued. such information, however, is subject to change without any prior notice. before purchasing or using any renesas electronics products listed herein, please confirm the latest product information with a renesas electronics sales office. also, please pay regular and careful attention to additional and different information to be disclosed by renesas electronics such as that disclosed through our website. 2. renesas electronics does not assume any liability for infringement of patents, copyrights, or other intellectual property ri ghts of third parties by or arising from the use of renesas electronics products or technical information described in this document . no license, express, implied or otherwise, is granted hereby under any patents, copyrights or other intellectual property right s of renesas electronics or others. 3. you should not alter, modify, copy, or otherwise misappropriate any renesas electronics product, whether in whole or in part . 4. descriptions of circuits, software and other related information in this document are provided only to illustrate the operat ion of semiconductor products and application examples. you are fully responsible for the incorporation of these circuits, software, and information in the design of your equipment. renesas electronics assumes no responsibility for any losses incurred by you or third parties arising from the use of these circuits, software, or information. 5. when exporting the products or technology described in this document, you should comply with the applicable export control laws and regulations and follow the procedures required by such laws and regulations. you should not use renesas electronics products or the technology described in this document for any purpose relating to military applications or use by the military, including but not limited to the development of weapons of mass destruction. renesas electronics products and technology may not be used for or incorporated into any products or systems whose manufacture, use, or sale is prohibited under any applicable domestic or foreign laws or regulations. 6. renesas electronics has used reasonable care in preparing the information included in this document, but renesas electronics does not warrant that such information is error free. renesas electronics assumes no liability whatsoever for any damages incurred by you resulting from errors in or omissions from the information included herein. 7. renesas electronics products are classified according to the following three quality grades: ?standard?, ?high quality?, an d ?specific?. the recommended applications for each renesas electronics product depends on the product?s quality grade, as indicated below. you must check the quality grade of each renesas electronics product before using it in a particular application. you may not use any renesas electronics product for any application categorized as ?specific? without the prior written consent of renesas electronics. further, you may not use any renesas electronics product for any application for which it is not intended without the prior written consent of renesas electronics. renesas electronics shall not be in any way liable for any damages or losses incurred by you or third parties arising from the use of any renesas electronics product for a n application categorized as ?specific? or for which the product is not intended where you have failed to obtain the prior writte n consent of renesas electronics. the quality grade of each renesas electronics product is ?standard? unless otherwise expressly specified in a renesas electronics data sheets or data books, etc. ?standard?: computers; office equipment; communications equipment; test and measurement equipment; audio and visual equipment; home electronic appliances; machine tools; personal electronic equipment; and industrial robots. ?high quality?: transportation equipment (automobiles, trains, ships, etc.); traffic control systems; anti-disaster systems; an ti- crime systems; safety equipment; and medical equipment not specifically designed for life support. ?specific?: aircraft; aerospace equipment; submersible repeaters; nuclear reactor control systems; medical equipment or systems for life support (e.g. artificial life support devices or systems), surgical implantations, or healthcare intervention (e.g. excision, etc.), and any other applications or purposes that pose a direct threat to human life. 8. you should use the renesas electronics products described in this document within the range specified by renesas electronics , especially with respect to the maximum rating, operating supply voltage range, movement power voltage range, heat radiation characteristics, installation and other product characteristics. renesas electronics shall have no liability for malfunctions o r damages arising out of the use of renesas electronics products beyond such specified ranges. 9. although renesas electronics endeavors to improve the quality and reliability of its products, semiconductor products have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. fur ther, renesas electronics products are not subject to radiation resistance design. please be sure to implement safety measures to guard them against the possibility of physical injury, and injury or damage caused by fire in the event of the failure of a renesas electronics product, such as safety design for hardware and software including but not limited to redundancy, fire control and malfunction prevention, appropriate treatment for aging degradation or any other appropriate measures. because the evaluation of microcomputer software alone is very difficult, please evaluate the safety of the final products or system manufactured by you. 10. please contact a renesas electronics sales office for details as to environmental matters such as the environmental compatibility of each renesas electronics product. please use renesas electronics products in compliance with all applicable laws and regulations that regulate the inclusion or use of controlled substances, including without limitation, the eu rohs directive. renesas electronics assumes no liability for damages or losses occurring as a result of your noncompliance with applicable laws and regulations. 11. this document may not be reproduced or duplicated, in any form, in whole or in part, without prior written consent of renes as electronics. 12. please contact a renesas electronics sales office if you have any questions regarding the information contained in this document or renesas electronics products, or if you have any other inquiries. (note 1) ?renesas electronics? as used in this document means renesas electronics corporation and also includes its majority- owned subsidiaries. (note 2) ?renesas electronics product(s)? means any product developed or manufactured by or for renesas electronics.
sh-2 sh7047 group hardware manual 32 users manual rev.2.00 2004.09 renesas 32-bit risc microcomputer superh? risc engine family/ sh7000 series sh7047f hd64f7047 sh7049 hd6437049
rev. 2.00, 09/04, page ii of xl
rev. 2.00, 09/04, page iii of xl 1. these materials are intended as a reference to assist our customers in the selection of the renesas technology corp. product best suited to the customer's application; they do not convey any license under any intellectual property rights, or any other rights, belonging to renesas technology corp. or a third party. 2. renesas technology corp. assumes no responsibility for any damage, or infringement of any third- party's rights, originating in the use of any product data, diagrams, charts, programs, algorithms, or circuit application examples contained in these materials. 3. all information contained in these materials, including product data, diagrams, charts, programs and algorithms represents information on products at the time of publication of these materials, and are subject to change by renesas technology corp. without notice due to product improvements or other reasons. it is therefore recommended that customers contact renesas technology corp. or an authorized renesas technology corp. product distributor for the latest product information before purchasing a product listed herein. the information described here may contain technical inaccuracies or typographical errors. renesas technology corp. assumes no responsibility for any damage, liability, or other loss rising from these inaccuracies or errors. please also pay attention to information published by renesas technology corp. by various means, including the renesas technology corp. semiconductor home page (http://www.renesas.com). 4. when using any or all of the information contained in these materials, including product data, diagrams, charts, programs, and algorithms, please be sure to evaluate all information as a total system before making a final decision on the applicability of the information and products. renesas technology corp. assumes no responsibility for any damage, liability or other loss resulting from the information contained herein. 5. renesas technology corp. semiconductors are not designed or manufactured for use in a device or system that is used under circumstances in which human life is potentially at stake. please contact renesas technology corp. or an authorized renesas technology corp. product distributor when considering the use of a product contained herein for any specific purposes, such as apparatus or systems for transportation, vehicular, medical, aerospace, nuclear, or undersea repeater use. 6. the prior written approval of renesas technology corp. is necessary to reprint or reproduce in whole or in part these materials. 7. if these products or technologies are subject to the japanese export control restrictions, they must be exported under a license from the japanese government and cannot be imported into a country other than the approved destination. any diversion or reexport contrary to the export control laws and regulations of japan and/or the country of destination is prohibited. 8. please contact renesas technology corp. for further details on these materials or the products contained therein. 1. renesas technology corp. puts the maximum effort into making semiconductor products better and more reliable, but there is always the possibility that trouble may occur with them. trouble with semiconductors may lead to personal injury, fire or property damage. remember to give due consideration to safety when making your circuit designs, with appropriate measures such as (i) placement of substitutive, auxiliary circuits, (ii) use of nonflammable material or (iii) prevention against any malfunction or mishap. keep safety first in your circuit designs! notes regarding these materials
rev. 2.00, 09/04, page iv of xl general precautions on handling of product 1. treatment of nc pins note: do not connect anything to the nc pins. the nc (not connected) pins are either not connected to any of the internal circuitry or are they are used as test pins or to reduce noise. if something is connect ed to the nc pins, the operation of the lsi is not guaranteed. 2. treatment of unused input pins note: fix all unused input pins to high or low level. generally, the input pins of cmos products are high-impedance input pins. if unused pins are in their open states, intermediate levels are induced by noise in the vicinity, a pass- through current flows internally, and a malfunction may occur. 3. processing before initialization note: when power is first supplied, the product?s state is undefined. the states of internal circuits are undefined until full power is supplied throughout the chip and a low level is input on the reset pi n. during the period where the states are undefined, the register settings and the output state of each pin are also undefined. design your system so that it does not malfunction because of processing while it is in this undefined state. for those products which have a reset function, reset the lsi immediately after the power supply has been turned on. 4. prohibition of access to undefined or reserved addresses note: access to undefined or reserved addresses is prohibited. the undefined or reserved addresses may be used to expand functions, or test registers may have been be allocated to these addresses. do not access these registers; the system?s operation is not guaranteed if they are accessed. precaution on handling hcan2 restrictions apply to the use of the hcan2. carefully read section 15.8, usage notes, beforehand.
rev. 2.00, 09/04, page v of xl configuration of this manual this manual comprises the following items: 1. general precautions on handling of product 2. configuration of this manual 3. preface 4. contents 5. overview 6. description of functional modules ? cpu and system-control modules ? on-chip peripheral modules the configuration of the functional description of each module differs according to the module. however, the generic style includes the following items: i) feature ii) input/output pin iii) register description iv) operation v) usage note when designing an application system that includ es this lsi, take notes into account. each section includes notes in relation to the descriptions given, and usage notes are given, as required, as the final part of each section. 7. electrical characteristics 8. appendix ? list of registers, product code lineup, and package dimensions ? main revisions and additions in this edition (only for revised versions) the list of revisions is a summary of points that have been revised or added to earlier versions. this does not include all of the revised contents . for details, see the actual locations in this manual. 9. index
rev. 2.00, 09/04, page vi of xl preface the sh7047 group single-chip risc (reduced instruction set computer) microprocessor includes a renesas -original risc cpu as its co re, and the peripheral functions required to configure a system. target users: this manual was written for users who will be using the sh7047 group micro- computer unit (mcu) in the design of application systems. users of this manual are expected to understand the fundamentals of electrical circui ts, logical circuits, and microcomputers. objective: this manual was written to explain the hardwa re functions and electrical characteristics of the sh7047 gr oup mcu to the above users. refer to the sh-1, sh-2, sh-dsp software ma nual for a detailed description of the instruction set. notes on reading this manual: ? product names the following products are covered in this manual. product classifications and abbreviations basic classification on-chip rom classification product code sh7047f flash memory version (rom: 256 kbytes) hd64f7047 sh7047 (100-pin version) sh7049 mask rom version (rom: 128 kbytes) hd6437049 in this manual, the product abbreviations are used to distinguish products. for example, 100- pin products are collectively refe rred to as the sh7047, an ab breviation of the basic type's classification code. there are two versions of each: a flash memory version and a mask rom version. when a description is limited to the fl ash memory version alone, the character f is added at the end of the abbreviation, such as sh7047f. when a description is limited to the mask rom version alone, an abbreviation that is determined by the rom size is used; sh7049 is used to indicate the mask rom version.
rev. 2.00, 09/04, page vii of xl ? the typical product the hd64f7047 is taken as the typical product for the descriptions in this manual. accordingly, when using an hd6437049, simply replace the hd 64f7047 in those references where no differences between products are pointed out with hd6437049. where differences are indicated, be aware that each specification apply to the products as indicated. ? in order to understand the overall functions of the chip read the manual according to the contents. this manual can be roughly categorized into parts on the cpu, system control functions, periph eral functions and elect rical characteristics. ? in order to understand the details of the cpu's functions read the sh-1, sh-2, sh-dsp software manual. ? in order to understand the details of a register when the user knows its name read the index that is the final part of the manual to find the page number of the entry on the register. the addresses, bit names, and initial values of the registers are summarized in appendix a, internal i/o register. rules: register name: the following notatio n is used for cases when the same or a similar function, e.g. serial communication, is implemented on more than one channel: xxx_n (xxx is the register name and n is the channel number) bit order: the msb (most significant bit) is on the left and the lsb (least significant bit) is on the right. related manuals: the latest versions of all related manuals are available from our web site. please ensure you have the latest versions of all documents you require. http://www.renesas.com sh7047 group manuals: document title document no. sh7047 group hardware manual this manual sh-1, sh-2, sh-dsp software manual rej09b0171
rev. 2.00, 09/04, page viii of xl users manuals for development tools: document title document no. superh risc engine c/c++ compiler, assembler, optimizing linkage editor user's manual ade-702-372 superh risc engine simulator/debugg er user's manual ade-702-186 high-performance embedded workshop user's manual ade-702-201
rev. 2.00, 09/04, page ix of xl contents section 1 overview............................................................................................1 1.1 features....................................................................................................................... ...... 2 1.2 internal bloc k diagram..................................................................................................... 4 1.3 pin arrangement ............................................................................................................... 5 1.4 pin functions .................................................................................................................. .. 6 section 2 cpu....................................................................................................13 2.1 features....................................................................................................................... ...... 13 2.2 register conf iguratio n...................................................................................................... 14 2.2.1 general regist ers (rn)......................................................................................... 14 2.2.2 control registers ................................................................................................. 16 2.2.3 system registers.................................................................................................. 17 2.2.4 initial values of registers.................................................................................... 17 2.3 data formats................................................................................................................... .. 18 2.3.1 data format in registers ..................................................................................... 18 2.3.2 data formats in memory ..................................................................................... 18 2.3.3 immediate data format ....................................................................................... 19 2.4 instruction features........................................................................................................... 20 2.4.1 risc-type instruction set................................................................................... 20 2.4.2 addressing modes ............................................................................................... 23 2.4.3 instruction format................................................................................................ 26 2.5 instruction set ................................................................................................................ ... 29 2.5.1 instruction set by classifica tion .......................................................................... 29 2.6 processing states.............................................................................................................. .42 2.6.1 state tran sitions .................................................................................................. 42 section 3 mcu operating modes .....................................................................45 3.1 selection of operating modes........................................................................................... 45 3.2 input/output pins .............................................................................................................. 46 3.3 explanation of op erating modes ...................................................................................... 47 3.3.1 mode 0 (mcu exte nsion mode 0) ....................................................................... 47 3.3.2 mode 1 (mcu exte nsion mode 1) ....................................................................... 47 3.3.3 mode 2 (mcu exte nsion mode 2) ....................................................................... 47 3.3.4 mode 3 (single chip mode).................................................................................. 47 3.3.5 clock mode ......................................................................................................... 47 3.4 address map .................................................................................................................... .48 3.5 initial state of this lsi..................................................................................................... 5 0
rev. 2.00, 09/04, page x of xl section 4 clock pulse generator....................................................................... 51 4.1 oscilla tor..................................................................................................................... ...... 52 4.1.1 connecting a crysta l resonator........................................................................... 52 4.1.2 external clock input method .............................................................................. 53 4.2 function for detecting the oscillato r halt........................................................................ 54 4.3 usage notes .................................................................................................................... .. 55 4.3.1 note on crysta l resonator................................................................................... 55 4.3.2 notes on board design ........................................................................................ 55 section 5 exception processing......................................................................... 57 5.1 overview....................................................................................................................... .... 57 5.1.1 types of exception pro cessing and priority ........................................................ 57 5.1.2 exception processi ng opera tions ........................................................................ 58 5.1.3 exception processing vector table ..................................................................... 59 5.2 resets......................................................................................................................... ....... 61 5.2.1 types of reset ..................................................................................................... 61 5.2.2 power-on reset ................................................................................................... 61 5.2.3 manual re set ....................................................................................................... 62 5.3 address errors ................................................................................................................. .63 5.3.1 the cause of address error exception................................................................ 63 5.3.2 address error excep tion processing ................................................................... 64 5.4 interrupts..................................................................................................................... ...... 65 5.4.1 interrupt sources.................................................................................................. 65 5.4.2 interrupt priority level ........................................................................................ 66 5.4.3 interrupt exceptio n proces sing ............................................................................ 66 5.5 exceptions triggered by instructions ............................................................................... 67 5.5.1 types of exceptions trig gered by instructions ................................................... 67 5.5.2 trap instructions.................................................................................................. 67 5.5.3 illegal slot in structions........................................................................................ 68 5.5.4 general illegal instructions.................................................................................. 68 5.6 cases when exception sour ces are not accepted........................................................... 69 5.6.1 immediately after a delayed branch instruction ................................................. 69 5.6.2 immediately after an interrup t-disabled instruction............................................ 69 5.7 stack status after except ion processing ends .................................................................. 70 5.8 usage notes .................................................................................................................... .. 71 5.8.1 value of stack pointer (sp) ................................................................................. 71 5.8.2 value of vector base register (vbr)................................................................. 71 5.8.3 address errors caused by stacking of address error exception processing...... 71 section 6 interrupt controller (intc)............................................................... 73 6.1 features....................................................................................................................... ...... 73 6.2 input/output pins.............................................................................................................. 75 6.3 register desc riptions........................................................................................................ 75
rev. 2.00, 09/04, page xi of xl 6.3.1 interrupt control re gister 1 (icr1)..................................................................... 76 6.3.2 interrupt control re gister 2 (icr2)..................................................................... 77 6.3.3 irq status regi ster (isr).................................................................................... 79 6.3.4 interrupt priority registers a, d to i, k (ipra, iprd to ipri, iprk) ............... 80 6.4 interrupt sources.............................................................................................................. .82 6.4.1 external interrupts ............................................................................................... 82 6.4.2 on-chip peripheral mo dule interrupts ................................................................ 83 6.4.3 user break interrupt ............................................................................................ 83 6.4.4 h-udi interrupt ................................................................................................... 83 6.5 interrupt exception proces sing vectors table.................................................................. 84 6.6 interrupt op eration............................................................................................................ 88 6.6.1 interrupt sequence ............................................................................................... 88 6.6.2 stack after interrupt ex ception pro cessing .......................................................... 90 6.7 interrupt response time................................................................................................... 91 6.8 data transfer with inte rrupt request signals ................................................................... 93 6.8.1 handling interrupt request signals as sources for dtc activating and cp u interrupt .............................................................................. 93 6.8.2 handling interrupt request signals as source for dtc activating, but no t cpu interrupt....................................................................... 94 6.8.3 handling interrupt request signals as source for cpu interrupt but not dtc activat ing........................................................................ 94 section 7 user break controller (ubc) ............................................................95 7.1 overview....................................................................................................................... .... 95 7.2 register desc riptions ........................................................................................................ 97 7.2.1 user break address register (ubar) ................................................................ 97 7.2.2 user break address mask register (ubamr) ................................................... 98 7.2.3 user break bus cycl e register (ubbr) ............................................................. 98 7.2.4 user break control register (ubcr) ................................................................. 100 7.3 operation ...................................................................................................................... .... 101 7.3.1 flow of the user br eak operation ....................................................................... 101 7.3.2 break on on-chip memory in struction fetc h cycle ........................................... 103 7.3.3 program counter (pc) values saved................................................................... 103 7.4 examples of use ............................................................................................................... 1 04 7.5 usage notes .................................................................................................................... .. 106 7.5.1 simultaneous fetching of two instru ctions ........................................................ 106 7.5.2 instruction fetches at branches ........................................................................... 106 7.5.3 contention between user break and exception pr ocessing ................................ 107 7.5.4 break at non-delay branch inst ruction jump de stinatio n.................................. 107 7.5.5 user break trigger output .................................................................................. 107 7.5.6 module standby m ode setti ng ............................................................................ 108
rev. 2.00, 09/04, page xii of xl section 8 data transfer controller (dtc)........................................................ 109 8.1 features....................................................................................................................... ...... 109 8.2 register desc riptions........................................................................................................ 11 1 8.2.1 dtc mode regist er (dtmr).............................................................................. 112 8.2.2 dtc source address re gister (dtsar) ............................................................ 114 8.2.3 dtc destination address register (d tdar) .................................................... 114 8.2.4 dtc initial address re gister (dtiar)............................................................... 114 8.2.5 dtc transfer count regi ster a (dt cra)......................................................... 114 8.2.6 dtc transfer count re gister b (d tcrb) ......................................................... 114 8.2.7 dtc enable regist ers (dte r) ........................................................................... 115 8.2.8 dtc control/status regi ster (dtcsr)............................................................... 116 8.2.9 dtc information base register (d tbr) ............................................................ 117 8.3 operation ...................................................................................................................... .... 118 8.3.1 activation so urces............................................................................................... 118 8.3.2 location of register informati on and dtc vector table ................................... 118 8.3.3 dtc operation .................................................................................................... 121 8.3.4 interrupt source ................................................................................................... 127 8.3.5 operation timing................................................................................................. 127 8.3.6 dtc execution st ate coun ts ............................................................................... 128 8.4 procedures for using dtc................................................................................................ 129 8.4.1 activation by in terrupt......................................................................................... 129 8.4.2 activation by software ........................................................................................ 129 8.4.3 dtc use example............................................................................................... 130 8.5 cautions on use ................................................................................................................ 131 8.5.1 prohibition against dtc regi ster access by dtc.............................................. 131 8.5.2 module standby m ode setting ............................................................................ 131 8.5.3 on-chip ram ..................................................................................................... 131 section 9 bus state controller (bsc) ............................................................... 133 9.1 features....................................................................................................................... ...... 133 9.2 input/output pin ............................................................................................................... 135 9.3 register config uration ...................................................................................................... 135 9.4 address map .................................................................................................................... .136 9.5 description of registers.................................................................................................... 138 9.5.1 bus control regist er 1 (bcr1) ........................................................................... 138 9.5.2 bus control regist er 2 (bcr2) ........................................................................... 139 9.5.3 wait control regist er 1 (wcr1) ........................................................................ 140 9.5.4 ram emulation regist er (ramer)................................................................... 140 9.6 accessing external space ................................................................................................. 141 9.6.1 basic timi ng........................................................................................................ 141 9.6.2 wait state c ontrol ............................................................................................... 142 9.6.3 cs assert period extension................................................................................. 144 9.7 waits between a ccess cycles........................................................................................... 145
rev. 2.00, 09/04, page xiii of xl 9.7.1 prevention of data bus conflicts......................................................................... 145 9.7.2 simplification of bus cycl e start det ection........................................................ 145 9.8 bus arbitr ati on................................................................................................................ .. 146 9.9 memory connection example .......................................................................................... 147 9.10 on-chip peripheral i/o register a ccess ........................................................................... 148 9.11 cycles in which bus is not rel eased................................................................................. 148 9.12 cpu operation when program is in external memory .................................................... 148 section 10 multi-function timer pulse unit (mtu) ........................................149 10.1 features....................................................................................................................... ...... 149 10.2 input/output pins .............................................................................................................. 153 10.3 register desc riptions ........................................................................................................ 15 4 10.3.1 timer control regi ster (tcr)............................................................................. 156 10.3.2 timer mode regist er (tmdr) ............................................................................ 160 10.3.3 timer i/o control re gister (tior) ..................................................................... 162 10.3.4 timer interrupt enable register (tier) .............................................................. 180 10.3.5 timer status regi ster (tsr)................................................................................ 182 10.3.6 timer counter (tcnt)........................................................................................ 185 10.3.7 timer general regi ster (tgr) ............................................................................ 185 10.3.8 timer start regist er (tstr) ............................................................................... 186 10.3.9 timer synchro regi ster (tsyr) ......................................................................... 187 10.3.10 timer output master enab le register (toer) ................................................... 188 10.3.11 timer output control register (t ocr).............................................................. 189 10.3.12 timer gate control re gister (tgcr) ................................................................. 191 10.3.13 timer subcounter (tcnts) ................................................................................ 192 10.3.14 timer dead time data register (tddr)............................................................ 192 10.3.15 timer period data re gister (t cdr) ................................................................... 193 10.3.16 timer period buffer register (tcbr)................................................................. 193 10.3.17 bus master in terface............................................................................................ 193 10.4 operation ...................................................................................................................... .... 194 10.4.1 basic func tions.................................................................................................... 194 10.4.2 synchronous op eration........................................................................................ 200 10.4.3 buffer operation .................................................................................................. 202 10.4.4 cascaded oper ation ............................................................................................. 206 10.4.5 pwm modes ........................................................................................................ 207 10.4.6 phase counting mode.......................................................................................... 212 10.4.7 reset-synchronized pwm mode......................................................................... 218 10.4.8 complementary pwm mode............................................................................... 222 10.5 interrupts..................................................................................................................... ...... 247 10.5.1 interrupts and pr iorities ........................................................................................ 247 10.5.2 dtc activa tion.................................................................................................... 249 10.5.3 a/d converter ac tivation .................................................................................... 249 10.6 operation timing.............................................................................................................. 2 50
rev. 2.00, 09/04, page xiv of xl 10.6.1 input/output timing............................................................................................ 250 10.6.2 interrupt signal timing ....................................................................................... 255 10.7 usage notes .................................................................................................................... .. 258 10.7.1 module standby m ode setting ............................................................................ 258 10.7.2 input clock rest rictions ...................................................................................... 258 10.7.3 caution on peri od setting .................................................................................... 259 10.7.4 contention between tcnt writ e and clear operations..................................... 259 10.7.5 contention between tcnt write and increment op erations.............................. 260 10.7.6 contention between tgr write and compare match......................................... 261 10.7.7 contention between buffer register write and comp are match ........................ 262 10.7.8 contention between tgr read and input capture.............................................. 264 10.7.9 contention between tgr write and input capture............................................. 265 10.7.10 contention between buffer register write and input capture ............................ 266 10.7.11 tcnt2 write and overflow/underflow co ntention in cascade connection ..... 266 10.7.12 counter value during comple mentary pwm mode stop ................................... 268 10.7.13 buffer operation se tting in complement ary pwm mode .................................. 268 10.7.14 reset sync pwm mode buffer opera tion and compare match flag ................. 269 10.7.15 overflow flags in rese t sync pwm mode......................................................... 270 10.7.16 contention between overflow/underfl ow and counter clearing........................ 271 10.7.17 contention between tcnt write and overflow/u nderflow............................... 272 10.7.18 cautions on transition from no rmal operation or pwm mode 1 to reset-synchr onous pwm mode .................................................................... 273 10.7.19 output level in complementary pwm mode and reset-synchronous pwm mode ......................................................................................................... 273 10.7.20 interrupts in module standby mode .................................................................... 273 10.7.21 simultaneous input capture of tcnt-1 and tcnt-2 in cascade connection... 273 10.8 mtu output pin in itializatio n.......................................................................................... 274 10.8.1 operating m odes ................................................................................................. 274 10.8.2 reset start op eration ........................................................................................... 274 10.8.3 operation in case of re-setting due to error during oper ation, etc. ................ 275 10.8.4 overview of initialization procedures and mode transitions in case of error during operation, etc. ........................................................................... 276 10.9 port output enab le (poe) ................................................................................................ 306 10.9.1 features................................................................................................................ 306 10.9.2 pin configuration................................................................................................. 308 10.9.3 register config uration......................................................................................... 308 10.9.4 operation ............................................................................................................. 313 10.9.5 usage notes ......................................................................................................... 315 section 11 watchdog timer.............................................................................. 317 11.1 features....................................................................................................................... ...... 317 11.2 input/output pin ............................................................................................................... 318 11.3 register desc riptions........................................................................................................ 31 9
rev. 2.00, 09/04, page xv of xl 11.3.1 timer counter (tcnt)........................................................................................ 319 11.3.2 timer control/status re gister (tcsr)................................................................ 319 11.3.3 reset control/status re gister (rstcsr)............................................................ 321 11.4 operation ...................................................................................................................... .... 322 11.4.1 watchdog time r mode ........................................................................................ 322 11.4.2 interval timer mode............................................................................................ 323 11.4.3 clearing software standby mode ........................................................................ 324 11.4.4 timing of setting the over flow flag (ovf) ....................................................... 324 11.4.5 timing of setting the watchdog ti mer overflow fl ag (wov f)........................ 325 11.5 interrupts..................................................................................................................... ...... 325 11.6 usage notes .................................................................................................................... .. 325 11.6.1 notes on regist er access..................................................................................... 325 11.6.2 tcnt write and increm ent contention .............................................................. 327 11.6.3 changing cks2 to ck s0 bit va lues .................................................................. 327 11.6.4 changing between watchdog time r/interval time r modes................................ 327 11.6.5 system reset by wdtovf signal...................................................................... 328 11.6.6 internal reset in watc hdog timer mode............................................................. 328 11.6.7 manual reset in watchd og timer mode............................................................. 328 11.6.8 handling of wdtovf pin .................................................................................. 328 section 12 serial communication interface (sci) ............................................329 12.1 features....................................................................................................................... ...... 329 12.2 input/output pins .............................................................................................................. 331 12.3 register desc riptions ........................................................................................................ 33 2 12.3.1 receive shift regi ster (rsr) .............................................................................. 333 12.3.2 receive data regi ster (rdr) .............................................................................. 333 12.3.3 transmit shift regi ster (tsr) ............................................................................. 333 12.3.4 transmit data regi ster (tdr)............................................................................. 333 12.3.5 serial mode regi ster (smr) ............................................................................... 334 12.3.6 serial control re gister (s cr) ............................................................................. 335 12.3.7 serial status regi ster (ssr) ................................................................................ 337 12.3.8 serial direction contro l register (sdcr)........................................................... 340 12.3.9 bit rate regist er (brr) ...................................................................................... 340 12.4 operation in asynch ronous mode .................................................................................... 351 12.4.1 data transfer format........................................................................................... 351 12.4.2 receive data sampling timing and reception margin in asynchronous mode ............................................................................................ 353 12.4.3 clock.................................................................................................................... 354 12.4.4 sci initialization (async hronous mo de).............................................................. 355 12.4.5 data transmission (asynchronous mode) ............................................................ 356 12.4.6 serial data reception (a synchronous mode) ........................................................ 358 12.5 multiprocessor co mmunication f unction......................................................................... 362 12.5.1 multiprocessor serial da ta transmission ............................................................ 364
rev. 2.00, 09/04, page xvi of xl 12.5.2 multiprocessor serial data reception ................................................................. 365 12.6 operation in clocked synchronous mode ........................................................................ 368 12.6.1 clock.................................................................................................................... 368 12.6.2 sci initialization (clocked synchronous mode) ................................................. 368 12.6.3 serial data transmission (c locked synchronou s mode)....................................... 369 12.6.4 serial data reception (clock ed synchronous mode) ............................................ 372 12.6.5 simultaneous serial data transmission and reception (clocked synchr onous mode)............................................................................. 374 12.7 sci interrupts................................................................................................................. ... 376 12.7.1 interrupts in normal serial co mmunication interface mode .............................. 376 12.8 usage notes .................................................................................................................... .. 377 12.8.1 tdr write and td re flag ................................................................................. 377 12.8.2 module standby m ode setting ............................................................................ 377 12.8.3 break detection and processing (asynchronous mode only)............................. 377 12.8.4 sending a break signal (async hronous mode only) .......................................... 377 12.8.5 receive error flags and transmit operations (clocked synchronous mode only) .................................................................... 378 12.8.6 constraints on dtc use ...................................................................................... 378 12.8.7 cautions on clocked synchron ous external clock mode................................... 378 12.8.8 caution on clocked synchronous internal cl ock mode...................................... 378 section 13 a/d converter ................................................................................. 379 13.1 features....................................................................................................................... ...... 379 13.2 input/output pins.............................................................................................................. 381 13.3 register desc ription ......................................................................................................... 38 2 13.3.1 a/d data registers 0 to 15 (addr0 to addr15)............................................. 382 13.3.2 a/d control/status registers 0, 1 (adcsr_0, adcsr_1)................................ 383 13.3.3 a/d control registers 0, 1 (adcr_0, ad cr_1)............................................... 384 13.3.4 a/d trigger select re gister (adtsr)................................................................ 386 13.4 operation ...................................................................................................................... .... 387 13.4.1 single mode......................................................................................................... 387 13.4.2 continuous scan mode........................................................................................ 387 13.4.3 single-cycle scan mode ..................................................................................... 388 13.4.4 input sampling and a/d conversion time ......................................................... 388 13.4.5 a/d converter activatio n by mtu or mmt ...................................................... 390 13.4.6 external trigger input timi ng............................................................................. 390 13.5 interrupt sources and dtc transfer requests ................................................................. 391 13.6 definitions of a/d co nversion accuracy......................................................................... 392 13.7 usage notes .................................................................................................................... .. 394 13.7.1 module standby m ode setting ............................................................................ 394 13.7.2 permissible signal s ource impedance ................................................................. 394 13.7.3 influences on abso lute accuracy ........................................................................ 394 13.7.4 range of analog power supply and other pin settings...................................... 395
rev. 2.00, 09/04, page xvii of xl 13.7.5 notes on boar d design ........................................................................................ 395 13.7.6 notes on noise co untermeasures ........................................................................ 395 section 14 compare match timer (cmt) ........................................................397 14.1 features....................................................................................................................... ...... 397 14.2 register desc riptions ........................................................................................................ 39 8 14.2.1 compare match timer start register (c mstr) ................................................. 398 14.2.2 compare match timer control/status register_0 and 1 (cmcsr_0, cm csr_1) ..................................................................................... 399 14.2.3 compare match timer counter_0 and 1 (cmcnt_0, cmcnt_1).................... 400 14.2.4 compare match timer constant regist er_0 and 1 (cmcor_0, cmcor_1).... 400 14.3 operation ...................................................................................................................... .... 400 14.3.1 cyclic count op eration ....................................................................................... 400 14.3.2 cmcnt count timing........................................................................................ 401 14.4 interrupts..................................................................................................................... ...... 401 14.4.1 interrupt sources.................................................................................................. 401 14.4.2 compare match flag set timing......................................................................... 401 14.4.3 compare match flag clear timi ng ..................................................................... 402 14.5 usage notes .................................................................................................................... .. 403 14.5.1 contention between cmcnt write and compare match................................... 403 14.5.2 contention between cmcnt word write and incrementation .......................... 404 14.5.3 contention between cmcnt byte write and incrementation ............................ 405 section 15 controller area network 2 (hcan2) .............................................407 15.1 features....................................................................................................................... ...... 407 15.2 input/output pins .............................................................................................................. 410 15.3 register desc riptions ........................................................................................................ 41 0 15.3.1 master control re gister (m cr) .......................................................................... 413 15.3.2 general status regi ster (gsr) ............................................................................ 418 15.3.3 bit timing configuration regi ster 1 (hcan2_bcr1) ...................................... 420 15.3.4 bit timing configuration regi ster 0 (hcan2_bcr0) ...................................... 422 15.3.5 interrupt request re gister (i rr) ......................................................................... 422 15.3.6 interrupt mask re gister (imr) ............................................................................ 427 15.3.7 error counter regist er (tec/r ec)..................................................................... 429 15.3.8 transmit wait registers (txpr1, tx pr0)......................................................... 430 15.3.9 transmit wait cancel regist ers (txcr1, txcr0)............................................ 432 15.3.10 transmit acknowledge register s (txack1, txack0) ................................... 434 15.3.11 abort acknowledge register s (aback1, aback0)........................................ 436 15.3.12 receive complete regist ers (rxpr1, rxpr0).................................................. 438 15.3.13 remote request register s (rfpr1, rfpr0) ...................................................... 440 15.3.14 mailbox interrupt mask regist ers (mbimr1, mbimr0) .................................. 442 15.3.15 unread message status regi sters (umsr1, umsr0) ........................................ 444 15.3.16 mailboxes (mb0 to mb31) ................................................................................. 445
rev. 2.00, 09/04, page xviii of xl 15.3.17 timer counter regist er (tcntr)....................................................................... 454 15.3.18 timer control regi ster (tcr)............................................................................. 455 15.3.19 timer status regi ster (tsr)................................................................................ 457 15.3.20 local offset regi ster (los r) ............................................................................. 458 15.3.21 input capture registers 0 and 1 (icr0, icr1).................................................... 459 15.3.22 timer compare match registers 0 and 1 (tcmr0 and tcmr1) ...................... 459 15.4 operation ...................................................................................................................... .... 460 15.4.1 hardware and soft ware resets ............................................................................ 460 15.4.2 initialization after ha rdware re set ...................................................................... 460 15.4.3 message transmission by event trigger............................................................. 466 15.4.4 message rece ption .............................................................................................. 469 15.4.5 mailbox reconfig uration..................................................................................... 472 15.4.6 hcan2 sleep mode............................................................................................ 473 15.4.7 hcan2 halt mode.............................................................................................. 476 15.5 interrupt sources.............................................................................................................. .477 15.6 dtc inte rface .................................................................................................................. .478 15.7 can bus in terface............................................................................................................ 47 9 15.8 usage notes .................................................................................................................... .. 479 15.8.1 time trigger transmit setting/ti mer operation disabled.................................. 479 15.8.2 reset .................................................................................................................... 479 15.8.3 hcan2 sleep mode............................................................................................ 480 15.8.4 interrupts.............................................................................................................. 480 15.8.5 error coun ters ..................................................................................................... 480 15.8.6 register a ccess.................................................................................................... 480 15.8.7 register in stan dby modes .................................................................................. 480 15.8.8 transmission cancellation duri ng sof or intermission...................................... 480 15.8.9 cases when the transmit wait register (txpr) is set during transfer of eof ................................................................ 481 15.8.10 limitation on access to the local a cceptance filter ma sk (lafm).................. 481 15.8.11 notes on using auto acknowledge mode .......................................................... 481 15.8.12 notes on usage of the transmit wa it cancel regist er (txcr) ......................... 481 15.8.13 setting and cancellation of transmi ssion during bus- idle state ........................ 482 15.8.14 releasing hcan 2 reset ..................................................................................... 482 15.8.15 accessing mailboxes when hc an2 is in sleep mode ...................................... 482 15.8.16 module standby m ode setting ............................................................................ 482 section 16 motor management timer (mmt) ................................................. 483 16.1 features....................................................................................................................... ...... 483 16.2 input/output pins.............................................................................................................. 485 16.3 register desc riptions........................................................................................................ 48 6 16.3.1 timer mode register (mmt_tmd r) ................................................................ 487 16.3.2 timer control regi ster (tcn r).......................................................................... 488 16.3.3 timer status regist er (mmt_t sr) .................................................................... 489
rev. 2.00, 09/04, page xix of xl 16.3.4 timer counter ( mmt_tcnt) ............................................................................ 490 16.3.5 timer buffer regi sters (tbr) ............................................................................. 490 16.3.6 timer general regi sters (tgr )........................................................................... 490 16.3.7 timer dead time coun ters (tdcnt)................................................................. 490 16.3.8 timer dead time data re gister (mmt _tddr) ................................................ 490 16.3.9 timer period buffer register (t pbr) ................................................................. 490 16.3.10 timer period data re gister (tpdr).................................................................... 491 16.4 operation ...................................................................................................................... .... 491 16.4.1 sample setting procedure .................................................................................... 492 16.4.2 output protectio n functions ................................................................................ 500 16.5 interrupts..................................................................................................................... ...... 500 16.6 operation timing.............................................................................................................. 5 01 16.6.1 input/output timing ............................................................................................ 501 16.6.2 interrupt signal timing........................................................................................ 504 16.7 usage notes .................................................................................................................... .. 505 16.7.1 module standby m ode setti ng ............................................................................ 505 16.7.2 notes for mmt op eration ................................................................................... 505 16.8 port output enab le (poe)................................................................................................. 508 16.8.1 features................................................................................................................ 508 16.8.2 input/output pins................................................................................................. 509 16.8.3 register desc riptions........................................................................................... 509 16.8.4 operation ............................................................................................................. 512 16.8.5 usage note........................................................................................................... 513 section 17 pin functio n controller (pfc).........................................................515 17.1 register desc riptions ........................................................................................................ 52 5 17.1.1 port a i/o register l (paior l)......................................................................... 525 17.1.2 port a control registers l3 to l1 (pacrl3 to pacrl1)................................. 525 17.1.3 port b i/o regist er (pbior) ............................................................................... 529 17.1.4 port b control registers 1 and 2 (pbcr1 and pbcr2)...................................... 529 17.1.5 port d i/o register l (pdior l)......................................................................... 530 17.1.6 port d control registers l1 an d l2 (pdcrl1 and pdcrl2) ........................... 531 17.1.7 port e i/o registers l and h (peiorl and peiorh)........................................ 532 17.1.8 port e control registers l1, l2, and h (pecrl1, pecrl2, and pecrh) ....... 533 17.2 precautions for use ........................................................................................................... 5 36 section 18 i/o ports ...........................................................................................537 18.1 port a......................................................................................................................... ....... 537 18.1.1 register desc riptions........................................................................................... 538 18.1.2 port a data regist er l (padrl) ........................................................................ 538 18.2 port b ......................................................................................................................... ....... 539 18.2.1 register desc riptions........................................................................................... 539 18.2.2 port b data regi ster (pbdr) .............................................................................. 539
rev. 2.00, 09/04, page xx of xl 18.3 port d......................................................................................................................... ....... 541 18.3.1 register desc riptions........................................................................................... 541 18.3.2 port d data regist er l (pddrl)........................................................................ 541 18.4 port e ......................................................................................................................... ....... 543 18.4.1 register desc riptions........................................................................................... 544 18.4.2 port e data registers h an d l (pedrh and pedrl) ........................................ 544 18.5 port f ......................................................................................................................... ....... 546 18.5.1 register desc riptions........................................................................................... 546 18.5.2 port f data regi ster (pfdr) ............................................................................... 546 section 19 flash memor y (f-ztat version)................................................... 549 19.1 features....................................................................................................................... ...... 549 19.2 mode tran sitions .............................................................................................................. 5 50 19.3 block configur ation ......................................................................................................... 554 19.4 input/output pins.............................................................................................................. 555 19.5 register desc riptions........................................................................................................ 55 5 19.5.1 flash memory control re gister 1 (f lmcr1) .................................................... 555 19.5.2 flash memory control re gister 2 (f lmcr2) .................................................... 557 19.5.3 erase block regist er 1 (ebr1) ........................................................................... 557 19.5.4 erase block regist er 2 (ebr2) ........................................................................... 558 19.5.5 ram emulation regist er (ramer)................................................................... 558 19.6 on-board programmi ng modes........................................................................................ 559 19.6.1 boot mode ........................................................................................................... 560 19.6.2 programming/erasing in user program mode..................................................... 562 19.7 flash memory emula tion in ra m ................................................................................... 563 19.8 flash memory progra mming/erasing............................................................................... 565 19.8.1 program/program-ve rify mode........................................................................... 565 19.8.2 erase/erase-veri fy mode .................................................................................... 567 19.8.3 interrupt handling when progra mming/erasing flash memory.......................... 567 19.9 program/erase pr otection ................................................................................................. 569 19.9.1 hardware protection ............................................................................................ 569 19.9.2 software protection ............................................................................................. 570 19.9.3 error protection ................................................................................................... 570 19.10 prom programme r mode................................................................................................ 571 19.11 notes on use................................................................................................................... .. 571 19.12 notes when converting the f-ztat vers ions to the mask-rom versions.................... 571 19.13 notes on flash memory progr amming and er asing ......................................................... 571 section 20 mask rom ...................................................................................... 577 20.1 notes on use................................................................................................................... .. 577 section 21 ram ................................................................................................ 579 21.1 usage note..................................................................................................................... ... 579
rev. 2.00, 09/04, page xxi of xl section 22 high-performance user debugging interface (h-udi) .................581 22.1 overview....................................................................................................................... .... 581 22.1.1 features................................................................................................................ 581 22.1.2 block diag ram..................................................................................................... 582 22.2 input/output pins .............................................................................................................. 583 22.3 register desc ription.......................................................................................................... 5 83 22.3.1 instruction regist er (sdir) ................................................................................. 584 22.3.2 status register (sdsr)........................................................................................ 585 22.3.3 data register (sddr) ......................................................................................... 586 22.3.4 bypass register (sdbpr) ................................................................................... 586 22.4 operation ...................................................................................................................... .... 587 22.4.1 h-udi interrupt ................................................................................................... 587 22.4.2 bypass mode ....................................................................................................... 590 22.4.3 h-udi reset ........................................................................................................ 590 22.5 usage notes .................................................................................................................... .. 590 section 23 advanced user debugger (aud)....................................................593 23.1 overview....................................................................................................................... .... 593 23.1.1 features................................................................................................................ 593 23.1.2 block diag ram..................................................................................................... 594 23.2 pin config uration.............................................................................................................. 594 23.2.1 pin descriptions................................................................................................... 595 23.3 branch trace mode........................................................................................................... 597 23.3.1 overview.............................................................................................................. 597 23.3.2 operation ............................................................................................................. 597 23.4 ram monitor mode ......................................................................................................... 598 23.4.1 overview.............................................................................................................. 598 23.4.2 communication protocol ..................................................................................... 599 23.4.3 operation ............................................................................................................. 599 23.5 usage notes .................................................................................................................... .. 601 23.5.1 initializatio n ......................................................................................................... 601 23.5.2 operation in software standby mode.................................................................. 601 23.5.3 setting the pa15/ck/ poe6 / trst / back pin.................................................... 601 23.5.4 pin stat es ............................................................................................................. 601 23.5.5 aud activation pr ocedures ................................................................................ 602 section 24 power-down modes ........................................................................603 24.1 input/outp ut pins ............................................................................................................. 606 24.2 register desc riptions ........................................................................................................ 60 6 24.2.1 standby control regi ster (sby cr) .................................................................... 607 24.2.2 system control regi ster (sys cr) ...................................................................... 608 24.2.3 module standby control register 1 and 2 (mstcr1 and mstcr2)................. 609 24.3 operation ...................................................................................................................... .... 611
rev. 2.00, 09/04, page xxii of xl 24.3.1 sleep mode .......................................................................................................... 611 24.3.2 software sta ndby mode ....................................................................................... 611 24.3.3 hardware stan dby mode ..................................................................................... 614 24.3.4 module standby mode......................................................................................... 615 24.4 usage notes .................................................................................................................... .. 615 24.4.1 i/o port st atus...................................................................................................... 615 24.4.2 current consumption duri ng oscillation stabiliza tion wait period.................... 616 24.4.3 on-chip peripheral mo dule interrupt.................................................................. 616 24.4.4 writing to mstcr1 and mst cr2 ..................................................................... 616 24.4.5 handling of hstby pin...................................................................................... 616 24.4.6 electromagnetic interference on hstby pin...................................................... 616 24.4.7 dtc or aud operation in sleep mode ............................................................... 617 section 25 electrical characteristics ................................................................. 619 25.1 absolute maximum ratings ............................................................................................. 619 25.2 dc character istics ............................................................................................................ 6 20 25.3 ac character istics ............................................................................................................ 6 23 25.3.1 test conditions for the ac character istics ......................................................... 623 25.3.2 clock timing ....................................................................................................... 624 25.3.3 control signal timing ......................................................................................... 626 25.3.4 bus timing .......................................................................................................... 629 25.3.5 multi-function timer pulse unit (mtu)timing ................................................ 633 25.3.6 i/o port ti ming.................................................................................................... 634 25.3.7 watchdog timer (w dt)timing.......................................................................... 635 25.3.8 serial communication in terface (sci)timing..................................................... 636 25.3.9 motor management time r (mmt) ti ming ......................................................... 638 25.3.10 port output enable (poe) timing....................................................................... 639 25.3.11 hcan2 timi ng ................................................................................................... 640 25.3.12 a/d converter timing......................................................................................... 641 25.3.13 h-udi timi ng ..................................................................................................... 642 25.3.14 aud timi ng........................................................................................................ 644 25.3.15 ubc trigger timing ........................................................................................... 646 25.4 a/d converter char acteristic s .......................................................................................... 647 25.5 flash memory char acteristic s .......................................................................................... 648 appendix a internal i/o register ..................................................................... 651 a.1 register addresses (ord er of address) ............................................................................ 651 a.2 register bits.................................................................................................................. .... 678 a.3 register states in ea ch operating mode .......................................................................... 690 appendix b pin states....................................................................................... 698 appendix c product code lineup .................................................................... 702
rev. 2.00, 09/04, page xxiii of xl appendix d package dimensions .....................................................................703 main revisions and additions in this edition .....................................................705 index ...................................................................................................................717
rev. 2.00, 09/04, page xxiv of xl
rev. 2.00, 09/04, page xxv of xl figures section 1 overview figure 1.1 block diagram of sh7047 ........................................................................................... .4 figure 1.2 sh7047 pin arrangement............................................................................................ .. 5 section 2 cpu figure 2.1 cpu in ternal re gisters ............................................................................................ .... 15 figure 2.2 data fo rmat in registers .......................................................................................... ... 18 figure 2.3 data formats in memory............................................................................................ .18 figure 2.4 transitions between proce ssing stat es ........................................................................ 42 section 3 mcu operating modes figure 3.1 the address map for the operating modes of sh7047 flash memory version ........ 48 figure 3.2 the address map for the operating modes of sh7049 mask rom version ............ 49 section 4 clock pulse generator figure 4.1 block diagram of the clock pulse generator ............................................................. 51 figure 4.2 connection of the crystal resonato r (example) ......................................................... 52 figure 4.3 crystal resona tor equivalent circuit .......................................................................... 52 figure 4.4 example of ex ternal clock connection ...................................................................... 53 figure 4.5 cautions for oscilla tor circuit system board design................................................. 55 figure 4.6 recommended external circuitry aro und the pll .................................................... 56 section 6 interrupt controller (intc) figure 6.1 intc block diagram ................................................................................................ .. 74 figure 6.2 block diagram of ir q3 to irq0 inte rrupts control................................................... 83 figure 6.3 interrupt sequence flowchart...................................................................................... 89 figure 6.4 stack after in terrupt exception processing.................................................................. 90 figure 6.5 example of th e pipeline operation when an irq interrupt is accepted ..................... 92 figure 6.6 interrupt control block diagram ................................................................................ 93 section 7 user break controller (ubc) figure 7.1 user break controller block diagram ........................................................................ 96 figure 7.2 break conditio n determinati on method ................................................................... 102 section 8 data transfer controller (dtc) figure 8.1 block diagram of dtc ............................................................................................. 1 10 figure 8.2 activating source control block diagram ............................................................... 118 figure 8.3 dtc register informat ion allocation in memory space.......................................... 119 figure 8.4 correspondence between dtc vect or address and transfer information............... 119 figure 8.5 dtc operation flowchart......................................................................................... 12 2 figure 8.6 memory mapp ing in normal mode .......................................................................... 123 figure 8.7 memory mapp ing in repeat mode ........................................................................... 124 figure 8.8 memory mapping in block transfer mode............................................................... 125
rev. 2.00, 09/04, page xxvi of xl figure 8.9 chain transfer.................................................................................................... ....... 126 figure 8.10 dtc operation ti ming example (normal mode) .................................................. 127 section 9 bus state controller (bsc) figure 9.1 bs c block diagram................................................................................................. .134 figure 9.2 address format .................................................................................................... ..... 136 figure 9.3 basic timing of external space access.................................................................... 141 figure 9.4 wait state timing of exte rnal space access (softw are wait only) ........................ 142 figure 9.5 wait state timing of extern al space access (two software wait states + wait signal wait st ate)...................................................................................................... 143 figure 9.6 cs assert period exte nsion func tion ....................................................................... 144 figure 9.7 example of id le cycle insertion at same space consecutive access....................... 145 figure 9.8 bus mastersh ip release pr ocedure ........................................................................... 147 figure 9.9 example of 8-bit da ta bus width rom connection................................................ 147 figure 9.10 one bus cycle.................................................................................................... ..... 148 section 10 multi-functi on timer pulse unit (mtu) figure 10.1 block diagram of mtu .......................................................................................... 152 figure 10.2 complementary pwm mode output level example ............................................. 190 figure 10.3 example of counte r operation setting procedure .................................................. 194 figure 10.4 free-runnin g counter operation ............................................................................ 195 figure 10.5 periodic counter operation..................................................................................... 19 6 figure 10.6 example of setting procedure for waveform output by compare match.............. 196 figure 10.7 example of 0 ou tput/1 output operation ............................................................... 197 figure 10.8 example of t oggle output op eration ..................................................................... 197 figure 10.9 example of input ca pture operation settin g procedure ......................................... 198 figure 10.10 example of input capture op eration .................................................................... 199 figure 10.11 example of synchro nous operation settin g procedure ........................................ 200 figure 10.12 example of synchronous op eration...................................................................... 201 figure 10.13 compare ma tch buffer operation......................................................................... 202 figure 10.14 input capt ure buffer op eration............................................................................. 203 figure 10.15 example of buffe r operation setting procedure................................................... 203 figure 10.16 example of buffer operation (1) .......................................................................... 204 figure 10.17 example of buffer operation (2) .......................................................................... 205 figure 10.18 cascaded op eration setting procedure ................................................................. 206 figure 10.19 example of cascaded operation ........................................................................... 207 figure 10.20 example of pw m mode setting pr ocedure .......................................................... 209 figure 10.21 example of pwm mode opera tion (1) ................................................................. 209 figure 10.22 example of pwm mode opera tion (2) ................................................................. 210 figure 10.23 example of pwm mode opera tion (3) ................................................................. 211 figure 10.24 example of phase counting mode settin g procedure........................................... 212 figure 10.25 example of phas e counting mode 1 operation .................................................... 213 figure 10.26 example of phas e counting mode 2 operation .................................................... 214 figure 10.27 example of phas e counting mode 3 operation .................................................... 215
rev. 2.00, 09/04, page xxvii of xl figure 10.28 example of phas e counting mode 4 operation .................................................... 216 figure 10.29 phase counting mode applicati on example......................................................... 217 figure 10.30 procedure for selecti ng the reset-synchronized pwm mode.............................. 220 figure 10.31 reset-synchronized pwm mode operation example (when the tocr?s olsn = 1 and olsp = 1)..................................................... 221 figure 10.32 block diagram of channels 3 and 4 in complementary pwm mode .................. 224 figure 10.33 example of compleme ntary pwm mode setti ng procedure................................ 226 figure 10.34 complementary pw m mode counter operation.................................................. 227 figure 10.35 example of comple mentary pwm mode operation ............................................ 229 figure 10.36 example of pwm cycle up dating........................................................................ 231 figure 10.37 example of data up date in complement ary pwm mode .................................... 233 figure 10.38 example of initial output in compleme ntary pwm mode (1)............................. 234 figure 10.39 example of initial output in compleme ntary pwm mode (2)............................. 235 figure 10.40 example of complementar y pwm mode waveform output (1) ......................... 237 figure 10.41 example of complementar y pwm mode waveform output (2) ......................... 237 figure 10.42 example of complementar y pwm mode waveform output (3) ......................... 238 figure 10.43 example of complementary pwm mode 0% and 100% waveform output (1) .. 238 figure 10.44 example of complementary pwm mode 0% and 100% waveform output (2) .. 239 figure 10.45 example of complementary pwm mode 0% and 100% waveform output (3) .. 239 figure 10.46 example of complementary pwm mode 0% and 100% waveform output (4) .. 240 figure 10.47 example of complementary pwm mode 0% and 100% waveform output (5) .. 240 figure 10.48 example of toggle output wa veform synchronized with pwm output............. 241 figure 10.49 counter clearing sync hronized with anot her channel ........................................ 242 figure 10.50 example of output phas e switching by extern al input (1)................................... 243 figure 10.51 example of output phas e switching by extern al input (2)................................... 244 figure 10.52 example of output phase switching by means of uf, vf, wf bit settings (1).. 244 figure 10.53 example of output phase switching by means of uf, vf, wf bit settings (2).. 245 figure 10.54 count timing in internal clock operation............................................................ 250 figure 10.55 count timing in external clock operation........................................................... 250 figure 10.56 count timing in external clock operation (phase counting mode).................... 251 figure 10.57 output compare output timing (normal mode/pwm mode)............................. 251 figure 10.58 output compare output timing (complementary pwm mode/res et synchronous pwm mode) ......................... 252 figure 10.59 input capt ure input signa l timing........................................................................ 252 figure 10.60 counter clea r timing (compare match) .............................................................. 253 figure 10.61 counter clea r timing (input capture) .................................................................. 253 figure 10.62 buffer operat ion timing (compa re match).......................................................... 254 figure 10.63 buffer operat ion timing (input capture) ............................................................. 254 figure 10.64 tgi interrup t timing (compare match) ............................................................... 255 figure 10.65 tgi interrup t timing (input capture) ................................................................... 255 figure 10.66 tciv in terrupt setting timing.............................................................................. 256 figure 10.67 tciu in terrupt setting timing.............................................................................. 256 figure 10.68 timing for status flag clearing by the cpu......................................................... 257
rev. 2.00, 09/04, page xxviii of xl figure 10.69 timing for status fl ag clearing by dt c activation ............................................ 257 figure 10.70 phase difference, overlap, and pulse width in phase counting mode ................ 258 figure 10.71 contention between tc nt write and clear operations....................................... 259 figure 10.72 contention between tcnt write and increment operations ............................... 260 figure 10.73 contention between tgr write and comp are match .......................................... 261 figure 10.74 contention between buffer regist er write and compare match (channel 0) ...... 262 figure 10.75 contention between buffer register write and compare match (channels 3 and 4)................................................................................................ 263 figure 10.76 contention between tgr read and input capture ............................................... 264 figure 10.77 contention between tgr write and inpu t capture .............................................. 265 figure 10.78 contention between buffer register write and input capture.............................. 266 figure 10.79 tcnt_2 write and overflow/underflow contention with cascade conn ection .............................................................................................. 267 figure 10.80 counter value during complementary pwm mode stop .................................... 268 figure 10.81 buffer operation and compar e-match flags in reset sync pwm mode............. 269 figure 10.82 reset sync pwm mode overfl ow flag ................................................................ 270 figure 10.83 contention between overflow and coun ter clearing ........................................... 271 figure 10.84 contention between tcnt write an d overfl ow................................................... 272 figure 10.85 error occurrence in norm al mode, recovery in normal mode........................... 277 figure 10.86 error occurrence in norm al mode, recovery in pwm mode 1........................... 278 figure 10.87 error occurrence in norm al mode, recovery in pwm mode 2........................... 279 figure 10.88 error occurrence in normal mode, recovery in ph ase counting mode .............. 280 figure 10.89 error occurrence in normal mode, recovery in complementary pwm mode ... 281 figure 10.90 error occurrence in normal mode, recovery in reset-sy nchronous pwm mode ....................................................... 282 figure 10.91 error occurrence in pwm mode 1, recovery in normal mode........................... 283 figure 10.92 error occurrence in pwm mode 1, recovery in pwm mode 1 .......................... 284 figure 10.93 error occurrence in pwm mode 1, recovery in pwm mode 2 .......................... 285 figure 10.94 error occurrence in pwm mode 1, recovery in phase counting mode.............. 286 figure 10.95 error occurrence in pwm mode 1, recovery in complementary pwm mode... 287 figure 10.96 error occurrence in pwm mode 1, recovery in reset-sy nchronous pwm mode ....................................................... 288 figure 10.97 error occurrence in pwm mode 2, recovery in normal mode........................... 289 figure 10.98 error occurrence in pwm mode 2, recovery in pwm mode 1 .......................... 290 figure 10.99 error occurrence in pwm mode 2, recovery in pwm mode 2 .......................... 291 figure 10.100 error occurrence in pwm m ode 2, recovery in phase counting mode............ 292 figure 10.101 error occurrence in phase counting mode, recovery in normal mode ............ 293 figure 10.102 error occurrence in phase counting mode, recovery in pwm mode 1............ 294 figure 10.103 error occurrence in phase counting mode, recovery in pwm mode 2............ 295 figure 10.104 error occurrence in phase counting mode, recovery in phase counting mode...................................................................................... 296 figure 10.105 error occurrence in complementary pwm mode, recovery in normal mode .................................................................................................. 297
rev. 2.00, 09/04, page xxix of xl figure 10.106 error occurrence in complementary pwm mode, recovery in pwm mode 1 .................................................................................................. 298 figure 10.107 error occurrence in complementary pwm mode, recovery in comple mentary pwm mode .......................................................... 299 figure 10.108 error occurrence in complementary pwm mode, recovery in comple mentary pwm mode .......................................................... 300 figure 10.109 error occurrence in complementary pwm mode, recovery in reset-sync hronous pwm mode ..................................................... 301 figure 10.110 error occurrence in reset-synchronous pwm mode, recovery in no rmal mode .................................................................................. 302 figure 10.111 error occurrence in reset-synchronous pwm mode, recovery in pw m mode 1 .................................................................................. 303 figure 10.112 error occurrence in reset-synchronous pwm mode, recovery in compleme ntary pwm mode .......................................................... 304 figure 10.113 error occurrence in reset-synchronous pwm mode, recovery in reset-sync hronous pwm mode..................................................... 305 figure 10.114 poe block diagram............................................................................................ 30 7 figure 10.115 low-leve l detection op eration.......................................................................... 313 figure 10.116 output-lev el detection op eration ...................................................................... 314 figure 10.117 falling edge detection op eration ....................................................................... 315 section 11 watchdog timer figure 11.1 block diagram of wdt .......................................................................................... 318 figure 11.2 operation in watchdog ti mer mode....................................................................... 323 figure 11.3 operation in interval ti mer mode........................................................................... 323 figure 11.4 ti ming of setting ovf............................................................................................ 324 figure 11.5 timi ng of setting wovf........................................................................................ 325 figure 11.6 writing to tcnt and tcsr ................................................................................... 326 figure 11.7 writing to rstcsr................................................................................................ .326 figure 11.8 contention between tcnt write and increment.................................................... 327 figure 11.9 example of system reset circuit using wdtovf signal .................................... 328 section 12 serial commu nication interface (sci) figure 12.1 bloc k diagram of sci............................................................................................. 330 figure 12.2 data format in asynchronous communication (example with 8-bit data, parity, two stop bits).................................................. 351 figure 12.3 receive data sampli ng timing in asynch ronous mode ........................................ 353 figure 12.4 relation between output clock and transmit data phase (asynchronous mode)............................................................................................. 354 figure 12.5 sample sci initialization fl owchart ....................................................................... 355 figure 12.6 example of operation in transmission in asynchronous mode (example with 8-bit data, parity, one st op bit) .................................................... 356 figure 12.7 sample serial transmission flowchart ................................................................... 357
rev. 2.00, 09/04, page xxx of xl figure 12.8 example of sci operation in reception (example with 8-bit data, parity, one st op bit) ................................................... 358 figure 12.9 sample serial reception data flow chart (1) .......................................................... 360 figure 12.9 sample serial reception data flow chart (2) .......................................................... 361 figure 12.10 example of communication using multiprocessor format (transmission of data h'aa to receiving st ation a) .......................................... 363 figure 12.11 sample multiprocessor serial transmissi on flowchart ........................................ 364 figure 12.12 example of sci operation in reception (example with 8-bit data, multip rocessor bit, one stop bit).............................. 365 figure 12.13 sample multiprocessor serial reception fl owchart (1)........................................ 366 figure 12.13 sample multiprocessor serial reception fl owchart (2)........................................ 367 figure 12.14 data format in clocked sy nchronous communication (for lsb-first) .............. 368 figure 12.15 sample sci initialization fl owchart ..................................................................... 369 figure 12.16 sample sci transmission operation in clocked synchronous mode .................. 370 figure 12.17 sample serial transmission flowchart ................................................................. 371 figure 12.18 example of sc i operation in reception ............................................................... 372 figure 12.19 sample seri al reception fl owchart ...................................................................... 373 figure 12.20 sample flowchart of simultane ous serial transmit and receive operations ...... 375 figure 12.21 example of clocked sy nchronous transmission with dtc ................................. 378 section 13 a/d converter figure 13.1 block di agram of a/d converter (for one module) ............................................. 380 figure 13.2 a/d conversion timing.......................................................................................... 38 9 figure 13.3 external trigger input timing ................................................................................ 390 figure 13.4 definitions of a/d conversion accuracy ............................................................... 393 figure 13.5 definitions of a/d conversion accuracy ............................................................... 393 figure 13.6 example of analog input circuit ............................................................................ 394 figure 13.7 example of anal og input protection circuit........................................................... 396 figure 13.8 analog input pin equivalent circuit ....................................................................... 396 section 14 compare match timer (cmt) figure 14.1 cm t block diagram............................................................................................... 3 97 figure 14.2 co unter operation ................................................................................................ ... 400 figure 14.3 count timing ..................................................................................................... ..... 401 figure 14.4 cmf set timing................................................................................................... ... 402 figure 14.5 timing of cmf clear by the cpu .......................................................................... 402 figure 14.6 cmcnt write an d compare match contentio n .................................................... 403 figure 14.7 cmcnt word write and increment contention .................................................... 404 figure 14.8 cmcnt byte write and increment contention...................................................... 405 section 15 controller area network 2 (hcan2) figure 15.1 hcan 2 block diagram .......................................................................................... 408 figure 15.2 regi ster config uration ........................................................................................... .412 figure 15.3 standard format .................................................................................................. .... 447
rev. 2.00, 09/04, page xxxi of xl figure 15.4 extended format .................................................................................................. ... 447 figure 15.5 hardware reset flowchart ...................................................................................... 461 figure 15.6 softwa re reset flowchart........................................................................................ 4 62 figure 15.7 detailed desc ription of 1- bit time ......................................................................... 463 figure 15.8 transmission fl owchart by event trigger .............................................................. 466 figure 15.9 transmit message cancellation flowchart ............................................................. 468 figure 15.10 flow chart in reception ......................................................................................... 4 69 figure 15.11 unread messa ge overwrite flowchart .................................................................. 471 figure 15.12 change of receive box id and change from receive box to transmit box....... 473 figure 15.13 hcan2 sl eep mode flowchart ............................................................................ 474 figure 15.14 hcan2 ha lt mode flowchart .............................................................................. 476 figure 15.15 dtc tr ansfer flowchart ....................................................................................... 478 figure 15.16 high-speed interface usin g ha13721 .................................................................. 479 section 16 motor management timer (mmt) figure 16.1 bloc k diagram of mmt.......................................................................................... 484 figure 16.2 sample opera ting mode setting procedure ............................................................ 492 figure 16.3 example of tcnt count op eration ....................................................................... 493 figure 16.4 examples of count er and register operations........................................................ 495 figure 16.5 example of pwm waveform generation ............................................................... 498 figure 16.6 example of tcnt counter clearing ....................................................................... 499 figure 16.7 example of toggle output waveform synchronized with pwm cycle................. 499 figure 16.8 count timing ..................................................................................................... ..... 501 figure 16.9 tcnt co unter clearing timing ............................................................................. 501 figure 16.10 tdcnt operation timing .................................................................................... 502 figure 16.11 buffer operation timing....................................................................................... 50 3 figure 16.12 tg i interrupt timing............................................................................................ .504 figure 16.13 timing of stat us flag clearing by cpu................................................................ 504 figure 16.14 timing of status fl ag clearing by dt c controlle r .............................................. 505 figure 16.15 contention between buffer register write and compare match .......................... 506 figure 16.16 contention between compar e register write and compare match...................... 507 figure 16.17 writing into timer general re gisters (when one cycle is not output).............. 508 figure 16.18 bloc k diagram of poe.......................................................................................... 50 9 figure 16.19 low level detection operation ............................................................................ 512 section 18 i/o ports figure 18.1 port a ........................................................................................................... ........... 537 figure 18.2 port b ........................................................................................................... ........... 539 figure 18.3 port d ........................................................................................................... ........... 541 figure 18.4 port e........................................................................................................... ............ 543 figure 18.5 port f ........................................................................................................... ............ 546 section 19 flash me mory (f-zta t version) figure 19.1 block diag ram of flash memory............................................................................ 550
rev. 2.00, 09/04, page xxxii of xl figure 19.2 flash memo ry state tran sitions .............................................................................. 551 figure 19.3 boot mode........................................................................................................ ....... 552 figure 19.4 user program mode ................................................................................................ 553 figure 19.5 flash memory block confi guration........................................................................ 554 figure 19.6 programming/erasing flow chart example in user program mode ........................ 562 figure 19.7 flowchart for flas h memory emulati on in ram ................................................... 563 figure 19.8 example of ra m overlap operation (ram[2:0] = b'000) .................................... 564 figure 19.9 program/prog ram-verify fl owchart ....................................................................... 566 figure 19.10 erase/eras e-verify flowchart ............................................................................... 568 figure 19.11 power-on/o ff timing (boot mode) ..................................................................... 574 figure 19.12 power-on/off timing (user program mode) ....................................................... 575 figure 19.13 mode transition timing (example: boot mode user mode user program mode) ............................. 576 section 20 mask rom figure 20.1 mask rom block diagram .................................................................................... 577 section 22 high-performance us er debugging interface (h-udi) figure 22.1 h-udi block diagram ............................................................................................ 58 2 figure 22.2 data input/o utput timing chart (1)........................................................................ 588 figure 22.3 data input/o utput timing chart (2)........................................................................ 589 figure 22.4 data input/o utput timing chart (3)........................................................................ 589 figure 22.5 serial data inpu t/output ......................................................................................... 591 section 23 advan ced user debugger (aud) figure 23.1 aud block diagram............................................................................................... 5 94 figure 23.2 example of data output (32-b it output) ................................................................ 598 figure 23.3 example of output in case of successive branches ............................................... 598 figure 23.4 auda ta input format .......................................................................................... 599 figure 23.5 example of re ad operation (b yte read) ................................................................ 600 figure 23.6 example of write operation (longw ord write) ..................................................... 600 figure 23.7 example of erro r occurrence (longword read) .................................................... 600 section 24 power-down modes figure 24.1 mode transition di agram ....................................................................................... 605 figure 24.2 nmi timing in software standby mode................................................................. 614 figure 24.3 transition timing to hardware st andby m ode....................................................... 615 figure 24.4 example of external circuit connected to hstby pin ......................................... 616 section 25 electrical characteristics figure 25.1 outp ut load circuit .............................................................................................. .. 623 figure 25.2 system clock timing.............................................................................................. 625 figure 25.3 extal clock input timing ................................................................................... 625 figure 25.4 osc illation settli ng time........................................................................................ .625 figure 25.5 re set input timing............................................................................................... ... 627 figure 25.6 re set input timing............................................................................................... ... 627
rev. 2.00, 09/04, page xxxiii of xl figure 25.7 interrup t signal inpu t timing.................................................................................. 62 8 figure 25.8 interrupt signal output timing ............................................................................... 628 figure 25.9 bu s release timing............................................................................................... .. 628 figure 25.10 basi c cycle (no waits) ......................................................................................... 6 30 figure 25.11 basic cycl e (one software wait) ......................................................................... 631 figure 25.12 basic cycle (two software waits + waits by wait signal) .............................. 632 figure 25.13 mtu i nput/output tim ing ..................................................................................... 633 figure 25.14 mtu cl ock input timing ..................................................................................... 633 figure 25.15 i/o port input/output timing ................................................................................. 634 figure 25.16 wdt timing ...................................................................................................... ... 635 figure 25.17 sci input timing................................................................................................ ... 636 figure 25.18 sci in put/output timing ...................................................................................... 637 figure 25.19 mmt i nput/output ti ming ................................................................................... 638 figure 25.20 poe in put/output timing ..................................................................................... 639 figure 25.21 hcan2 input/output timing................................................................................. 640 figure 25.22 external trigger input timing .............................................................................. 641 figure 25.23 h- udi clock timing ............................................................................................ 64 2 figure 25.24 h-udi trst timing ............................................................................................ 643 figure 25.25 h-udi input/output timing ................................................................................. 643 figure 25.26 aud reset timing................................................................................................ 645 figure 25.27 br anch trace timing............................................................................................. 645 figure 25.28 ram monitor timing ........................................................................................... 645 figure 25.29 ubc trigger timing ............................................................................................. 6 46 appendix d package dimensions figure d.1 fp-100m........................................................................................................... ........ 703
rev. 2.00, 09/04, page xxxiv of xl
rev. 2.00, 09/04, page xxxv of xl tables section 2 cpu table 2.1 initial values of registers....................................................................................... 17 table 2.2 sign extension of word data ................................................................................. 20 table 2.3 delayed branch instructions................................................................................... 20 table 2.4 t bit ........................................................................................................................ 21 table 2.5 immediate data accessing ..................................................................................... 21 table 2.6 absolute addre ss accessing................................................................................... 22 table 2.7 displacement accessing ......................................................................................... 22 table 2.8 addressing modes and ef fective addresses........................................................... 23 table 2.9 instruction formats ................................................................................................. 27 table 2.10 classification of instructions .................................................................................. 29 section 3 mcu operating modes table 3.1 selection of operating modes ................................................................................ 45 table 3.2 maximum operating clock freque ncy for each clock mode ............................... 46 table 3.3 operating mode pin configuration......................................................................... 46 section 4 clock pulse generator table 4.1 damping resistance values ................................................................................... 52 table 4.2 crystal resonator characteristics ........................................................................... 52 section 5 exception processing table 5.1 types of exception pro cessing and priority ........................................................... 57 table 5.2 timing for exception source detection an d start of exception processing........... 58 table 5.3 exception processing vector table ........................................................................ 59 table 5.4 calculating exception processing vector table addresses.................................... 60 table 5.5 reset st atus............................................................................................................. 61 table 5.6 bus cycles and ad dress errors............................................................................... 63 table 5.7 interrupt sources..................................................................................................... 65 table 5.8 interrupt priority ..................................................................................................... 66 table 5.9 types of exceptions trig gered by instructions ...................................................... 67 table 5.10 generation of exception sources imme diately after a delayed branch instruction or interrupt- disabled instruction .......................................................... 69 table 5.11 stack status after excep tion processing ends ........................................................ 70 section 6 interrupt controller (intc) table 6.1 pin configuration.................................................................................................... 75 table 6.2 interrupt exception processing vectors and priorities ........................................... 85 table 6.3 interrupt response time......................................................................................... 91 section 8 data transfer controller (dtc) table 8.1 interrupt sources, dtc vector addr esses, and corresponding dtes ................. 120 table 8.2 normal mode regist er functions ......................................................................... 123
rev. 2.00, 09/04, page xxxvi of xl table 8.3 repeat mode regist er functions .......................................................................... 124 table 8.4 block transfer mode re gister functions ............................................................. 125 table 8.5 execution state of dtc........................................................................................ 128 table 8.6 state counts needed fo r execution state ............................................................. 128 section 9 bus state controller (bsc) table 9.1 pin configuration.................................................................................................. 135 table 9.2 address ma p......................................................................................................... 137 table 9.3 on-chip peripheral i/o register access ............................................................... 148 section 10 multi-functi on timer pulse unit (mtu) table 10.1 mtu functio ns..................................................................................................... 150 table 10.2 mtu pins ............................................................................................................. 153 table 10.3 cclr0 to cclr2 (channel s 0, 3, and 4) ............................................................. 157 table 10.4 cclr0 to cclr2 (cha nnels 1 an d 2) .................................................................. 157 table 10.5 tpsc0 to tpsc2 (channel 0) ............................................................................... 158 table 10.6 tpsc0 to tpsc2 (channel 1) ............................................................................... 158 table 10.7 tpsc0 to tpsc2 (channel 2) ............................................................................... 159 table 10.8 tpsc0 to tpsc2 (cha nnels 3 and 4).................................................................... 159 table 10.9 md0 to md3 ........................................................................................................ 161 table 10.10 tiorh_0 (channel 0) ....................................................................................... 164 table 10.11 tiorh_0 (channel 0) ....................................................................................... 165 table 10.12 tiorl_0 (channel 0)........................................................................................ 166 table 10.13 tiorl_0 (channel 0)........................................................................................ 167 table 10.14 tior_1 (channel 1) .......................................................................................... 168 table 10.15 tior_1 (channel 1) .......................................................................................... 169 table 10.16 tior_2 (channel 2) .......................................................................................... 170 table 10.17 tior_2 (channel 2) .......................................................................................... 171 table 10.18 tiorh_3 (channel 3) ....................................................................................... 172 table 10.19 tiorh_3 (channel 3) ....................................................................................... 173 table 10.20 tiorl_3 (channel 3)........................................................................................ 174 table 10.21 tiorl_3 (channel 3)........................................................................................ 175 table 10.22 tiorh_4 (channel 4) ....................................................................................... 176 table 10.23 tiorh_4 (channel 4) ....................................................................................... 177 table 10.24 tiorl_4 (channel 4)........................................................................................ 178 table 10.25 tiorl_4 (channel 4)........................................................................................ 179 table 10.26 output level sel ect function ........................................................................... 189 table 10.27 output level sel ect function ........................................................................... 190 table 10.28 output level sel ect function............................................................................. 192 table 10.29 register combinations in buffer operation ..................................................... 202 table 10.30 cascaded comb inations.................................................................................... 206 table 10.31 pwm output registers and output pins .......................................................... 208 table 10.32 phase counting mode cl ock input pins ........................................................... 212 table 10.33 up/down-count conditions in phase counting mode 1.................................. 213
rev. 2.00, 09/04, page xxxvii of xl table 10.34 up/down-count conditions in phase counting mode 2.................................. 214 table 10.35 up/down-count conditions in phase counting mode 3.................................. 215 table 10.36 up/down-count conditions in phase counting mode 4.................................. 216 table 10.37 output pins for reset-sy nchronized pwm mode ............................................ 218 table 10.38 register settings for reset- synchronized pwm mode .................................... 218 table 10.39 output pins for complementary pwm mode .................................................. 222 table 10.40 register settings for comp lementary pw m mode .......................................... 223 table 10.41 registers and counters re quiring initiali zation ............................................... 230 table 10.42 mtu interrupts ................................................................................................. 248 table 10.43 mode transition co mbinations ........................................................................ 275 table 10.44 pin configuration.............................................................................................. 308 table 10.45 pin combinations.............................................................................................. 308 section 11 watchdog timer table 11.1 pin configuration.................................................................................................. 318 table 11.2 wdt interrupt source (in in terval timer mode) ................................................. 325 section 12 serial commu nication interface (sci) table 12.1 pin configuration.................................................................................................. 331 table 12.2 relationships between n setting in brr and effective bit rate b 0 .................... 341 table 12.3 brr settings for various bit rates (asynchronous mode) (1) ........................... 342 table 12.3 brr settings for various bit rates (asynchronous mode) (2) ........................... 342 table 12.3 brr settings for various bit rates (asynchronous mode) (3) ........................... 343 table 12.3 brr settings for various bit rates (asynchronous mode) (4) ........................... 343 table 12.4 maximum bit rate for each frequency when using baud rate generator (asynchronou s mode) .......................................................................................... 344 table 12.5 maximum bit rate with external cl ock input (asynchronous mode) ................ 345 table 12.6 brr settings for various bit rates (clo cked synchronous mode) (1) ............... 346 table 12.6 brr settings for various bit rates (clo cked synchronous mode) (2) ............... 347 table 12.6 brr settings for various bit rates (clo cked synchronous mode) (3) ............... 348 table 12.6 brr settings for various bit rates (clo cked synchronous mode) (4) ............... 349 table 12.7 maximum bit rate with external clock input (clocked synchronous mode) .... 350 table 12.8 serial transfer formats (asynchronous mode).................................................... 352 table 12.9 ssr status flags and recei ve data ha ndling ...................................................... 359 table 12.10 sci interrupt sources........................................................................................ 376 section 13 a/d converter table 13.1 pin configuration.................................................................................................. 381 table 13.2 channel select list ............................................................................................... 384 table 13.3 a/d conversion time (single mode)................................................................... 389 table 13.4 a/d conversion time (scan mode) ..................................................................... 390 table 13.5 a/d converter inte rrupt sour ce............................................................................ 391 table 13.6 analog pin speci fications..................................................................................... 396
rev. 2.00, 09/04, page xxxviii of xl section 15 controller area network 2 (hcan2) table 15.1 hcan2 pi ns ......................................................................................................... 410 table 15.2 mailbox configuratio n bit settin g ....................................................................... 453 table 15.3 message data area configura tion in tct b it setting ......................................... 454 table 15.4 limits on bcr setta ble values ............................................................................ 463 table 15.5 setting range for tseg1 a nd tseg2 in bcr..................................................... 464 table 15.6 hcan2 interrupt sources .................................................................................... 477 section 16 motor management timer (mmt) table 16.1 pin configuration.................................................................................................. 485 table 16.2 initial values of tbru to tbrw and initia l output ........................................... 496 table 16.3 relationship between a/d conversion start timing and operating mode.......... 500 table 16.4 mmt interrupt sources ........................................................................................ 500 table 16.5 pin configuration.................................................................................................. 509 section 17 pin function controller (pfc) table 17.1 multiplexed pins (port a)..................................................................................... 515 table 17.2 multiplexed pins (port b) ..................................................................................... 516 table 17.3 multiplexed pins (port d)..................................................................................... 516 table 17.4 sh7047 multiplexed pi ns (port e) ....................................................................... 517 table 17.5 multiplexed pins (port f) ..................................................................................... 518 table 17.6 pin functions in each mode (1) ........................................................................... 519 table 17.7 sh7047 pin functions in each mode (2) ............................................................. 522 section 18 i/o ports table 18.1 port a data register l (padrl) read/write operations ................................... 539 table 18.2 port b data register (pbdr) read/write operations ......................................... 540 table 18.3 port d data register l (pddrl) read/write operations ................................... 542 table 18.4 port e data registers h and l (pedrh and pedrl) read/write operations ... 545 table 18.5 port f data register (pfdr) read/write operations .......................................... 547 section 19 flash me mory (f-zta t version) table 19.1 differences between boot mode and user program mode .................................. 551 table 19.2 pin configuration.................................................................................................. 555 table 19.3 setting on-board prog ramming modes ............................................................... 559 table 19.4 boot mode operation ........................................................................................... 561 table 19.5 peripheral clock (p ) frequencies for which automatic adjustment of lsi b it rate is po ssible ................................................................ 561 section 22 high-performance us er debugging interface (h-udi) table 22.1 h-udi pins ........................................................................................................... 583 table 22.2 serial transfer characteristic s of h-udi registers.............................................. 584 section 23 advan ced user debugger (aud) table 23.1 aud pins.............................................................................................................. 594 table 23.2 ready flag format ............................................................................................... 600
rev. 2.00, 09/04, page xxxix of xl section 24 power-down modes table 24.1 internal operation stat es in each mode ............................................................... 604 table 24.2 pin configuration.................................................................................................. 606 section 25 electrical characteristics table 25.1 absolute maximum ratings ................................................................................. 619 table 25.2 dc character istics ................................................................................................ 620 table 25.3 permitted output cu rrent values.......................................................................... 622 table 25.4 clock timing ........................................................................................................ 624 table 25.5 control signal timing .......................................................................................... 626 table 25.6 bus timing ........................................................................................................... 629 table 25.7 multi-function timer pu lse unit ti ming ............................................................. 633 table 25.8 i/o port timing..................................................................................................... 634 table 25.9 watchdog timer timing....................................................................................... 635 table 25.10 serial communication interface timing........................................................... 636 table 25.11 motor management timer timing ................................................................... 638 table 25.12 port output enable timing ............................................................................... 639 table 25.13 hcan2 timing ................................................................................................ 640 table 25.14 a/d converter timing...................................................................................... 641 table 25.15 h-udi timing .................................................................................................. 642 table 25.16 aud timing ..................................................................................................... 644 table 25.17 ubc trigger timing ........................................................................................ 646 table 25.18 a/d converter char acteristic s .......................................................................... 647 table 25.19 flash memory char acteristic s .......................................................................... 648 appendix b pin states table b.1 pin states (1)......................................................................................................... 698 table b.2 pin states (2)......................................................................................................... 699 table b.3 pin states (3)......................................................................................................... 700 table b.4 pin states (4)......................................................................................................... 700 table b.5 pin states (5)......................................................................................................... 701 table b.6 pin states (6)......................................................................................................... 701
rev. 2.00, 09/04, page xl of xl
rev. 2.00, 09/04, page 1 of 720 section 1 overview the sh7047 group single-chip risc (reduced instruction set computer) microprocessors integrate a renesas-original risc cpu core with peripheral functions required for system configuration. the sh7047 group cpu has a risc-type instruction set . most instructions can be executed in one state (one system clock cycle), which great ly improves instruct ion execution speed . in addition, the 32-bit internal-bus architecture enhances data processing power. with this cpu, it has become possible to assemble low cost, high performance/high-functioning systems, even for applications that were previously impossible with microproces sors, such as real-time control, which demands high speeds. in addition, the sh7047 group in cludes on-chip peripheral f unctions necessary for system configuration, such as large- capacity rom and ram, timers, a serial communication interface (sci), controller area network 2 (hcan2), an a/d converter, an interrupt controller (intc), and i/o ports. rom and sram can be directly co nnected to the sh7047 mcu by means of an external memory access support function. this greatly reduces system cost. there are two versions of on-chip rom: f-ztat tm (flexible zero turn around time) that includes flash memory, and mask rom. the flash memory can be programmed with a programmer that supports sh7047 group programming, and can also be programmed and erased by software. this enables lsi chip to be re-pro grammed at a user-site wh ile mounted on a board. note: f-ztat tm is a trademark of renesas technology corp.
rev. 2.00, 09/04, page 2 of 720 1.1 features ? central processing unit with an internal 32 -bit risc (reduced instruction set computer) architecture ? instruction length: 16-bit fixed length for improved code efficiency ? load-store architecture (basic operat ions are executed between registers) ? sixteen 32-bit general registers ? five-stage pipeline ? on-chip multiplier: multiplication operations (32 bits 32 bits 64 bits) executed in two to four cycles ? c language-oriented 62 basic instructions ? various peripheral functions ? data transfer controller (dtc) ? multifunction timer/pulse unit (mtu) ? motor management timer(mmt) ? compare match timer (cmt) ? watchdog timer (wdt) ? asynchronous or clocked synchronous serial communication interface(sci) ? 10-bit a/d converter ? clock pulse generator ? controller area network2 (hcan2) ? user break controller (ubc)* ? high-performance user de bug interface (h-udi) * ? advanced user debugger (aud)* note: * supported only for flash memory version.
rev. 2.00, 09/04, page 3 of 720 ? on-chip memory rom model rom ram remarks flash memory version hd64f7047 256 kbytes 12 kbytes mask rom version hd6437049 128 kbytes 8 kbytes ? maximum operating frequency and operating temperature range model maximum operating frequency (mhz) (system clock ( ) and peripheral clock (p )) operating temperature range ( c) HD64F7047F50/hd6437049f50 (50, 25) or (40, 40) -20 to +75 hd64f7047fw40/hd6437049fw40 (40, 40) -40 to +85 hd64f7047fj40/hd6437049fj40 (40, 40) -40 to +85 ? i/o ports model no. of i/o pins no. of input-only pins hd64f7047/hd6437049 53 16 ? supports various power-down states ? compact package model package (code) b ody size pin pitch hd64f7047/hd6437049 qfp-100 fp-100m 14.0 14.0 mm 0.5 mm
rev. 2.00, 09/04, page 4 of 720 1.2 internal block diagram pe21/pwob/sck4/a15 pe20/pvob/txd4/a14 pe19/puob/rxd4/a13 pe18/pwoa/a12 pe17/pvoa/ wait /a11 pe16/puoa/ ubctrg /a10 pe15/tioc4d/ irqout pe14/tioc4c pe13/tioc4b/ mres pe12/tioc4a pe11/tioc3d pe10/tioc3c/txd2/ wrl pe9/tioc3b pe8/tioc3a/sck2 pe7/tioc2b/rxd2/a9 pe6/tioc2a/sck3/a8 pe5/tioc1b/txd3/a7 pe4/tioc1a/rxd3/a6 pe3/tioc0d pe2/tioc0c pe1/tioc0b pe0/tioc0a/ cs0 : peripheral address bus (12 bits) : peripheral data bus (16 bits) : internal address bus (32 bits) : internal upper data bus (16 bits) : internal lower data bus (16 bits) res wdtovf hstby md3 md2 md1 md0 nmi extal xtal pllvcl pllcap pllvss vcl vcl fwp vcc vcc vcc vcc vss vss vss vss vss avcc avcc avss avss serial communication interface ( 3 channels) multifunction timer pulse unit interrupt controller user break controller bus state controller compare match timer ( 2 channels) a/d converter watchdog timer flash rom/ mask rom cpu data transfer controller ram pll notes: * 1 asebrkak , dbgmd pins: f-ztat version only * 2 modules for f-ztat version only pd8/ ubctrg pd7/d7/ audsync pd6/d6/audck pd5/d5/audmd pd4/d4/ audrst pd3/d3/audata3 pd2/d2/sck2/audata2 pd1/d1/txd2/audata1 pd0/d0/rxd2/audata0 pf15/an15 pf14/an14 pf13/an13 pf12/an12 pf11/an11 pf10/an10 pf9/an9 pf8/an8 pf7/an7 pf6/an6 pf5/an5 pf4/an4 pf3/an3 pf2/an2 pf1/an1 pf0/an0 motor management timer ( 1 channel) controller area network 2 h-udi * 2 pb5/ irq3 / poe3 /ck pb4/ irq2 / poe2 /sck4 pb3/ irq1 / poe1 /txd4 pb2/ irq0 / poe0 /rxd4 pb1/a17/hrxd1/sck4 pb0/a16/htxd1 pa15/ck/ poe6 / trst / bac k pa14/ rd / poe5 /tms pa13/ poe4 /tdo/ breq pa12/ wrl / ubctrg /tdi pa11/ adtrg /sck3 pa10/ cs0 / rd /tck/sck2 pa9/tclkd/ irq3 /txd3 pa8/tclkc/ irq2 /rxd3 pa7/tclkb/ wait /txd2 pa6/tclka/ rd /rxd2 pa5/ irq1 /a5/ poe6 /sck3 pa4/a4/ poe5 /txd3 pa3/a3/ poe4 /rxd3 pa2/ irq0 /a2/pcio/sck2 pa1/a1/ poe1 /txd2 pa0/a0/ poe0 /rxd2 aud * 2 dbgmd * 1 asebrkak * 1 * 2 figure 1.1 block diagram of sh7047
rev. 2.00, 09/04, page 5 of 720 1.3 pin arrangement 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 v ss av ss pf0/an0 pf8/an8 av cc pf1/an1 pf9/an9 pf2/an2 pf10/an10 pf3/an3 pf11/an11 pf12/an12 pf4/an4 pf13/an13 pf5/an5 pf14/an14 pf6/an6 av cc pf15/an15 pf7/an7 av ss v ss pe21/pwob/sck4/a15 v c l pe20/pvob/txd4/a14 wdtovf pe0/tioc0a/ cs0 pe1/tioc0b pe2/tioc0c pe3/tioc0d pe4/tioc1a/rxd3/a6 pe5/tioc1b/txd3/a7 pe6/tioc2a/sck3/a8 pe7/tioc2b/rxd2/a9 pe8/tioc3a/sck2 asebrkak * 1 pe9/tioc3b v ss pe10/tioc3c/txd2/ wrl v cc dbgmd * 1 pe11/tioc3d pe12/tioc4a pe13/tioc4b/ mres pe14/tioc4c pe15/tioc4d/ irqout pe16/puoa/ ubctrg /a10 pe17/pvoa/ wait /a11 pe18/pwoa/a12 pe19/puob/rxd4/a13 pa0/a0/ poe0 /rxd2 v ss pa1/a1/ poe1 /txd2 v cc pa2/ irq0 /a2/pcio/sck2 pa3/a3/ poe4 /rxd3 pa4/a4/ poe5 /txd3 pa5/ irq1 /a5/ poe6 /sck3 pa6/tclka/ rd /rxd2 pa7/tclkb/ wait /txd2 pa8/tclkc/ irq2 /rxd3 pa9/tclkd/ irq3 /txd3 pa10/ cs0 / rd /tck/sck2 pa11/ adtrg /sck3 pa12/ wrl / ubctrg /tdi pa13/ poe4 /tdo/ breq pa14/ rd / poe5 /tms pa15/ck/ poe6 / trst / bac k pb0/a16/htxd1 pb1/a17/hrxd1/sck4 pb2/ irq0 / poe0 /rxd4 pb3/ irq1 / poe1 /txd4 v cc pb4/ irq2 / poe2 /sck4 pb5/ irq3 / poe3 /ck pd8/ ubctrg v c l pd7/d7/ audsync pd6/d6/audck pd5/d5/audmd pd4/d4/ audrst v ss * 2 fwp v cc hstby pd3/d3/audata3 res pd2/d2/sck2/audata2 nmi pd1/d1/txd2/audata1 md3 pd0/d0/rxd2/audata0 md2 md1 md0 extal xtal pllv c l pllcap pllv ss qfp-100 (top view) notes: * 1 pin for e10a debugging mode dbgmd : fixed to vcc for the mask version. used as the dbgmd input pin for the f-ztat version. asebrkak : * 2 for the mask rom version, connect this pin to vcc product mask version f-ztat version (e10a used) f-ztat version (e10a unused) processing method vcc fixed enabled disabled disabled vcc fixed enabled disabled disabled pull up enabled enabled enabled pull down enabled disabled enabled nc enabled enabled enabled figure 1.2 sh7047 pin arrangement
rev. 2.00, 09/04, page 6 of 720 1.4 pin functions type symbol i/o name function vcc input power supply power supply pins. connect all these pins to the system power supply. the chip does not operate normally when some of these pins are open. vss input ground ground pins. connect all these pins to the system power supply (0 v). the chip does not operate normally when some of these pins are open. power supply vcl output power supply for internal power-down external capacitance pins for internal power-down power supply. connect this pin to vss via a 0.47 f (?10%/+100%) capacitor (placed close to the pin). pllvcl output power supply for pll external capacitance pin for internal power-down power supply for an on-chip pll oscillator. connect this pin to pllvss via a 0.47 f (?10%/+100%) capacitor (placed close to the pin). pllvss input ground for pll on-chip pll oscillator ground pin. pllcap input capacitance for pll external capacitance pin for an on-chip pll oscillator. extal input external clock for connection to a crystal resonator. (an external clock can be supplied from the extal pin.) for examples of crystal resonator connection and external clock input, see section 4, clock pulse generator. xtal input crystal for connection to a crystal resonator. for examples of crystal resonator connection and external clock input, see section 4, clock pulse generator. clock ck output system clock supplies the system clock to external devices.
rev. 2.00, 09/04, page 7 of 720 type symbol i/o name function md3 md2 md1 md0 input set the mode set the oper ating mode. inputs at these pins should not be changed during operation. operating mode control fwp input protection against write operation into flash memory pin for the flash memory. this pin is only used in the flash memory version. writing or erasing of flash memory can be protected. this pin becomes the vcc pin for the mask rom version. res input power on reset when this pin is driven low, the chip becomes to power on reset state. mres input manual reset when this pin is driven low, the chip becomes to manual reset state. hstby input standby when this pin is driven low, a transition is made to hardware standby mode. wdtovf output watchdog timer overflow output signal for the watchdog timer overflow. if this pin need to be pulled- down, use the resistor larger than 1 m ? to pull the pin down. breq input bus request external device can request the release of the bus mastership by setting this pin low. system control back output bus acknowledge shows that the bus mastership has been released for the external device. the device that had issued the breq signal can know that bus mastership has been released for itself by receiving the back signal. nmi input non-maskable interrupt non-maskable interrupt pin. if this pin is not used, it should be fixed high, or fixed low. irq3 irq2 irq1 irq0 input interrupt request 3 to 0 these pins request a maskable interrupt. one of the level input or edge input can be selected. in case of the edge input, one of the rising edge, falling edge, or both can be selected. interrupts irqout output interrupt request output shows that an interrupt cause has occurred. the interrupt cause can be recognized even in the bus release state. address bus a17 to a0 output address bus output the address. data bus d7 to d0 input/ output data bus bi-directional 8-bits bus.
rev. 2.00, 09/04, page 8 of 720 type symbol i/o name function cs0 output chip select 0 chip select signal for external memory or devices. rd output read shows reading from external devices. wrl output write lower half shows writing into the lower 8 bits (bit7 to bit0) of the external data. bus control wait input wait inserts the wait cycles into the bus cycle when accessing the external spaces. tclka tclkb tclkc tclkd input external clock input for mtu timer these pins input an external clock. tioc0a tioc0b tioc0c tioc0d input/ output mtu input capture/output compare (channel 0) the tgra_0 to tgrd_0 input capture input/output compare output/pwm output pins. tioc1a tioc1b input/ output mtu input capture/output compare (channel 1) the tgra_1 to tgrb_1 input capture input/output compare output/pwm output pins. tioc2a tioc2b input/ output mtu input capture/output compare (channel 2) the tgra_2 to tgrb_2 input capture input/output compare output/pwm output pins. tioc3a tioc3b tioc3c tioc3d input/ output mtu input capture/output compare (channel 3) the tgra_3 to tgrd_3 input capture input/output compare output/pwm output pins. multi function timer-pulse unit (mtu) tioc4a tioc4b tioc4c tioc4d input/ output mtu input capture/output compare (channel 4) the tgra_4 to tgrd_4 input capture input/output compare output/pwm output pins. txd2 txd3 txd4 output transmitted data data output pins. rxd2 rxd3 rxd4 input received data data input pins. serial com- munication interface (sci) sck2 sck3 sck4 input/ output serial clock clock input/output pins.
rev. 2.00, 09/04, page 9 of 720 type symbol i/o name function htxd1 output transmitted data the can bus transmission pin hcan2 hrxd1 input received data the can bus reception pin puoa output u-phase of pwm u-phase output pin for 6-phase non- overlap pwm waveforms. puob output u -phase of pwm u -phase output pin for 6-phase non- overlap pwm waveforms. pvoa output v-phase of pwm v-phase output pin for 6-phase non- overlap pwm waveforms. pvob output v -phase of pwm v -phase output pin for 6-phase non- overlap pwm waveforms. pwoa output w-phase of pwm w-phase output pin for 6-phase non- overlap pwm waveforms. pwob output w -phase of pwm w -phase output pin for 6-phase non- overlap pwm waveforms. motor management timer (mmt) pcio input/ output pwm control counter clear input pin by external input or output pin for toggle synchronized with pwm period. output control for mtu and mmt poe6 to poe0 input port output control input pins for the signal to request the output pins of mtu or mmt to become high impedance state. an15 to an0 input analog input pins analog input pins. adtrg input input of trigger for a/d conversion pin for input of an external trigger to start a/d conversion avcc input analog power supply power supply pin for the a/d converter. when the a/d converter is not used, connect this pin to the system power supply (+5 v). connect all avcc pins to the power supply. the chip does not operate normally when some of these pins are open. a/d converter avss input analog ground the ground pin for the a/d converter. connect this pin to the system power supply (0 v). connect all avss pins to the system power supply the chip does not operate normally when some of these pins are open.
rev. 2.00, 09/04, page 10 of 720 type symbol i/o name function pa15 to pa0 input/ output general purpose port 16-bits general purpose input/output pins pb5 to pb0 input/ output general purpose port 6-bits general purpose input/output pins. pd8 to pd0 input/ output general purpose port 9-bits general purpose input/output pins. pe21 to pe0 input/ output general purpose port 22-bits general purpose input/output pins. i/o ports pf15 to pf0 input general purpose port 16-bits general purpose input pins. user break controller (ubc) (flash memory version only) ubctrg output user break trigger output ubc condition match trigger output pin. tck input test clock test clock input pin. tms input test mode select test mode select signal input pin. tdi input test data input instruction/data serial input pin. tdo output test data output instruction/data serial output pin. high- performance user debug interface (h-udi) (flash memory version only) trst input test reset initializ ation signal input pin. audata3 to audata0 input/ output aud data branch trace m ode: branch destination address output pins. ram monitor mode: monitor address input/data input/output pins. audrst input aud reset reset signal input pin. audmd input aud mode mode select signal input pin. branch trace mode: low ram monitor mode: high audck input/ output aud clock branch trace mode: synchronous clock output pin. ram monitor mode: synchronous clock input pin. advanced user debugger (aud) (flash memory version only) audsync input/ output aud synchroniza- tion signal branch trace mode: data start position identification signal output pin. ram monitor mode: data start position identification signal input pin.
rev. 2.00, 09/04, page 11 of 720 type symbol i/o name function asebrkak output break mode acknowledge shows that e10a has entered to the break mode. refer to ?e10a emulator user?s manual for sh7047? for the detail of the connection to e10a. e10 interface (flash memory version only) dbgmd input debug mode enables the functions of e10a emulator. input high to the pin in normal operation (other than the debug mode). in debug mode, input low to the pin on the user board. refer to ?e10a emulator user?s manual for sh7047? for the detail of the connection to e10a.
rev. 2.00, 09/04, page 12 of 720
rev. 2.00, 09/04, page 13 of 720 section 2 cpu 2.1 features ? general-register architecture ? sixteen 32-bit general registers ? sixty-two basic instructions ? eleven addressing modes ? register direct [rn] ? register indirect [@rn] ? register indirect with post-increment [@rn+] ? register indirect with pre-decrement [@-rn] ? register indirect with displacement [@disp:4,rn] ? register indirect with index [@r0, rn] ? gbr indirect with disp lacement [@disp:8,gbr] ? gbr indirect with index [@r0,gbr] ? program-counter relative with displacement [@disp:8,pc] ? program-counter relative [disp:8/disp:12/rn] ? immediate [#imm:8]
rev. 2.00, 09/04, page 14 of 720 2.2 register configuration the register set consists of sixteen 32-bit general registers, three 32-bit cont rol registers, and four 32-bit system registers. 2.2.1 general registers (rn) the sixteen 32-bit general registers (rn) are numbered r0?r15. general registers are used for data processing and address calculation. r0 is also used as an index register. several instructions have r0 fixed as their only usable register. r15 is used as the hardware stack pointer (sp). saving and recovering the status register (sr) and prog ram counter (pc) in exception processing is accomplished by referencing the stack using r15.
rev. 2.00, 09/04, page 15 of 720 31 0 r0 * 1 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15, sp (hardware stack pointer) * 2 general registers (rn) status register (sr) global base register (gbr) vector base register (vbr) multiply-accumulate register (mac) procedure register (pr) program counter (pc) 31 9 8 7 6 5 4 3 2 1 0 0 0 31 m gbr 31 vbr qi3i2i1i0 s t 31 0 mach 31 0 pr 31 0 pc macl notes: * 1 r0 functions as an index register in the indirect indexed register addressing mode and indirect indexed gbr addressing mode. in some instructions, r0 functions as a fixed source register or destination register. * 2 r15 functions as a hardware stack pointer (sp) during exception processing. figure 2.1 cpu internal registers
rev. 2.00, 09/04, page 16 of 720 2.2.2 control registers the control registers consist of three 32-bit registers: status register (sr), global base register (gbr), and vector base register (vbr). the status register indicates proces sing states. the global base register functions as a base address for the indirect gbr addressing mode to transfer data to the registers of on-chip peripheral modules. the vector base register functions as the base address of the exception processing vector area (including interrupts). status register (sr): bit bit name initial value r/w description 31 to 10 ? all 0 r/w reserved these bits are always read as 0. the write value should always be 0. 9 m undefined r/w used by the div0 u, div0s, and div1 instructions. 8 q undefined r/w used by the div0 u, div0s, and div1 instructions. 7 to 4 i3 to i0 all 1 r/w interrupt mask bits. 3, 2 ? all 0 r/w reserved these bits are always read as 0. the write value should always be 0. 1 s undefined r/w s bit used by the mac instruction. 0 t undefined r/w t bit the movt, cmp/cond, tas, tst, bt (bt/s), bf (bf/s), sett, and clrt instructions use the t bit to indicate true (1) or false (0). the addv, addc, subv, subc, div0u, div0s, div1, negc, shar, shal , shlr, shll, rotr, rotl, rotcr, and rotcl inst ructions also use the t bit to indicate carry/bo rrow or overflow/underflow. global base register (gbr): indicates the base address of th e indirect gbr addressing mode. the indirect gbr addressing mode is used in data transfer for on-chip peripheral modules register areas and in logic operations. vector base register (vbr): indicates the base address of the exception processing vector area.
rev. 2.00, 09/04, page 17 of 720 2.2.3 system registers system registers consist of four 32-bit registers: high and low multiply and accumulate registers (mach and macl), the procedure register (pr), and the program counter (pc). multiply-and-accumulate registers (mac): registers to store the results of multiply-and- accumulate operations. procedure register (pr): registers to store the return address from a subroutine procedure. program counter (pc): registers to indicate the sum of current instruction addresses and four, that is, the address of the second instruction after the current instruction. 2.2.4 initial values of registers table 2.1 lists the values of the registers after reset. table 2.1 initial values of registers classification register initial value r0 to r14 undefined general registers r15 (sp) value of the sta ck pointer in the vector address table sr bits i3 to i0 are 1111 (h'f), reserved bits are 0, and other bits are undefined gbr undefined control registers vbr h'00000000 mach, macl, pr undefined system registers pc value of the program counter in the vector address table
rev. 2.00, 09/04, page 18 of 720 2.3 data formats 2.3.1 data format in registers register operands are always longwords (32 bits). if the size of memory operand is a byte (8 bits) or a word (16 bits), it is changed into a longword by expanding the sign-part when loaded into a register. 31 0 longword figure 2.2 data format in registers 2.3.2 data formats in memory memory data formats are classified into bytes, words, and longwords. byte data can be accessed from any address. locate, however, word data at an address 2n, longword data at 4n. otherwise, an address error will occur if an attempt is made to access word data starti ng from an ad dress other than 2n or longword data starting from an address other than 4n. in such cases, the data accessed cannot be guaranteed. the hardware stack area, poin ted by the hardware stack pointer (sp, r15), uses only longword data starting from address 4n because this area holds the program counter and status register. 31 0 15 23 7 byte byte byte byte word word address 2n address 4n longword address m address m + 2 address m + 1 address m + 3 figure 2.3 data formats in memory
rev. 2.00, 09/04, page 19 of 720 2.3.3 immediate data format byte (8 bit) immediate data resides in an inst ruction code. immediate da ta accessed by the mov, add, and cmp/eq instructions is sign-extended and handled in registers as longword data. immediate data accessed by the tst, and, or , and xor instructions is zero-extended and handled as longword data. consequently, and instructions with immediate data always clear the upper 24 bits of the destination register. word or longword immediate data is not located in the instruction code, but instead is stored in a memory table. an immediate data transfer instruction (mov) acce sses the memory table using the pc relative addressing mo de with displacement.
rev. 2.00, 09/04, page 20 of 720 2.4 instruction features 2.4.1 risc-type instruction set all instructions are risc type. this section details their functions. 16-bit fixed length : all instructions are 16 bits long , increasing program code efficiency. one instruction per state : the microprocessor can execute basi c instructions in one state using the pipeline system. one stat e is 25 ns at 40 mhz. data length : longword is the standard data length for all operations. memory can be accessed in bytes, words, or longwords. by te or word data accessed from memory is sign-extended and handled as longword data. immediate data is sign-extended for arithmetic operations or zero- extended for logic operations. it also is handled as longword data. table 2.2 sign extension of word data cpu of this lsi description example of conventional cpu mov.w @(disp,pc),r1 add r1,r0 ......... .data.w h'1234 data is sign-extended to 32 bits, and r1 becomes h'00001234. it is next operated upon by an add instruction. add.w #h'1234,r0 note: @(disp, pc) accesses the immediate data. load-store architecture : basic operations are executed betw een registers. for operations that involve memory access, da ta is loaded to the registers an d executed (load-store architecture). instructions such as and that manipulate bi ts, however, are executed directly in memory. delayed branch instructions : unconditional branch instructions are delayed branch instructions. with a delayed branch instruction, the branch is taken after execution of the instruction following the delayed branch instruction. this reduces the disturbance of the pipeline control in case of branch instructions. there are two types of conditional branch instructions: delayed branch instructions and ordinary branch instructions. table 2.3 delayed branch instructions cpu of this lsi description example of conventional cpu bra trget add r1,r0 executes the add before branching to trget. add.w r1,r0 bra trget
rev. 2.00, 09/04, page 21 of 720 multiply/multiply-and-ac cumulate operations: 16-bit 16-bit 32-bit multiply operations are executed in one to two states. 16-bit 16-bit + 64-bit 64-bit multiply-and-accumulate operations are executed in two to three states. 32-bit 32-bit 64-bit multiply and 32-bit 32-bit + 64-bit 64-bit multiply-and-accumulate operations are executed in two to four states. t bit : the t bit in the status regist er changes according to the resu lt of the comparison. whether a conditional branch is taken or not taken depends upon the t bit condition (true/false). the number of instructions that change the t bit is kept to a minimum to improve the processing speed. table 2.4 t bit cpu of this lsi description example of conventional cpu cmp/ge r1,r0 bt trget0 bf trget1 t bit is set when r0 r1. the program branches to trget0 when r0 r1 and to trget1 when r0 < r1. cmp.w r1,r0 bge trget0 blt trget1 add # ? 1,r0 cmp/eq #0,r0 bt trget t bit is not changed by add. t bit is set when r0 = 0. the program branches if r0 = 0. sub.w #1,r0 beq trget immediate data : byte (8-bit) immediate data is located in an instruction code. word or longword immediate data is not located in instruction c odes but in a memory table. an immediate data transfer instruction (mov) accesses the memory tabl e using the pc relative addressing mode with displacement. table 2.5 immediat e data accessing classification cpu of this lsi example of conventional cpu 8-bit immediate mov #h'12,r0 mov.b #h'12,r0 16-bit immediate mov.w @(disp,pc),r0 ................. .data.w h'1234 mov.w #h'1234,r0 32-bit immediate mov.l @(disp,pc),r0 ................. .data.l h'12345678 mov.l #h'12345678,r0 note: @(disp, pc) accesses the immediate data.
rev. 2.00, 09/04, page 22 of 720 absolute address : when data is accessed by absolute addre ss, the value in the absolute address is placed in the memory table in advance. that valu e is transferred to the register by loading the immediate data during the execution of the instru ction, and the data is accessed in the indirect register addressing mode. table 2.6 absolute address accessing classification cpu of this lsi example of conventional cpu absolute address mov.l @(disp,pc),r1 mov.b @r1,r0 .................. .data.l h'12345678 mov.b @h'12345678,r0 note: @(disp,pc) accesses the immediate data. 16-bit/32-bit displacement : when data is accessed by 16-b it or 32-bit displacement, the displacement value is placed in the memory table in advance. that value is transferred to the register by loading the immediate data during the execution of the instruction, and the data is accessed in the indirect indexe d register addressing mode. table 2.7 displacement accessing classification cpu of this lsi example of conventional cpu 16-bit displacement mov.w @(disp,pc),r0 mov.w @(r0,r1),r2 .................. .data.w h'1234 mov.w @(h'1234,r1),r2 note: @(disp,pc) accesses the immediate data.
rev. 2.00, 09/04, page 23 of 720 2.4.2 addressing modes table 2.8 describes addressing modes and effective address calculation. table 2.8 addressing modes and effective addresses addressing mode instruction format effective address calculation equation direct register addressing rn the effective address is register rn. (the operand is the contents of register rn.) ? indirect register addressing @rn the effective address is t he contents of register rn. rn rn rn post-increment indirect register addressing @rn+ the effective address is the contents of register rn. a constant is added to t he content of rn after the instruction is executed. 1 is added for a byte operation, 2 for a word operation, and 4 for a longword operation. rn rn 1/2/4 + rn + 1/2/4 rn (after the instruction executes) byte: rn + 1 rn word: rn + 2 rn longword: rn + 4 rn pre-decrement indirect register addressing @-rn the effective address is the value obtained by subtracting a constant from rn. 1 is subtracted for a byte operation, 2 for a word operation, and 4 for a longword operation. rn 1/2/4 rn ? 1/2/4 ? rn ? 1/2/4 byte: rn ? 1 rn word: rn ? 2 rn longword: rn ? 4 rn (instruction is executed with rn after this calculation)
rev. 2.00, 09/04, page 24 of 720 addressing mode instruction format effective address calculation equation indirect register addressing with displacement @(disp:4, rn) the effective address is the sum of rn and a 4-bit displacement (disp). the value of disp is zero- extended, and remains unchanged for a byte operation, is doubled for a word operation, and is quadrupled for a longword operation. rn rn + disp 1/2/4 + 1/2/4 disp (zero-extended) byte: rn + disp word: rn + disp 2 longword: rn + disp 4 indirect indexed register addressing @(r0, rn) the effective address is the sum of rn and r0. rn r0 rn + r0 + rn + r0 indirect gbr addressing with displacement @(disp:8, gbr) the effective address is the sum of gbr value and an 8-bit displacement (disp). the value of disp is zero-extended, and remains unchanged for a byte operation, is doubled for a word operation, and is quadrupled for a longword operation. gbr 1/2/4 gbr + disp 1/2/4 + disp (zero-extended) byte: gbr + disp word: gbr + disp 2 longword: gbr + disp 4 indirect indexed gbr addressing @(r0, gbr) the effective address is the sum of gbr value and r0. gbr r0 gbr + r0 + gbr + r0
rev. 2.00, 09/04, page 25 of 720 addressing mode instruction format effective address calculation equation indirect pc addressing with displacement @(disp:8, pc) the effective address is the sum of pc value and an 8-bit displacement (disp). the value of disp is zero-extended, and is doubled for a word operation, and quadrupled for a longword operation. for a longword operation, the lowest two bits of the pc value are masked. pc h'fffffffc pc + disp 2 or pc & h'fffffffc + disp 4 + 2/4 & (for longword) disp (zero-extended) word: pc + disp 2 longword: pc & h'fffffffc + disp 4 disp:8 the effective address is the sum of pc value and the value that is obtained by doubling the sign- extended 8-bit displacement (disp). pc 2 + disp (sign-extended) pc + disp 2 pc + disp 2 pc relative addressing disp:12 the effective address is the sum of pc value and the value that is obtained by doubling the sign- extended 12-bit displacement (disp). pc 2 + disp (sign-extended) pc + disp 2 pc + disp 2
rev. 2.00, 09/04, page 26 of 720 addressing mode instruction format effective address calculation equation pc relative addressing rn the effective address is t he sum of the register pc and rn. pc rn pc + rn + pc + rn immediate addressing #imm:8 the 8-bit immediate data (imm) for the tst, and, or, and xor instructions is zero-extended. ? #imm:8 the 8-bit immediate data (imm) for the mov, add, and cmp/eq instructions is sign-extended. ? #imm:8 the 8-bit immediate data (imm) for the trapa instruction is zero-extended and then quadrupled. ? 2.4.3 instruction format the instruction formats and the meaning of source and destination operand are described below. the meaning of the operand depends on the instru ction code. the symbols used are as follows: ? xxxx: instruction code ? mmmm: source register ? nnnn: destination register ? iiii: immediate data ? dddd: displacement
rev. 2.00, 09/04, page 27 of 720 table 2.9 instruction formats instruction formats source operand destination operand example 0 format xxxx xxxx xxxx xxxx 15 0 ? ? nop ? nnnn: direct register movt rn control register or system register nnnn: direct register sts mach,rn n format xxxx xxxx xxxx nnnn 15 0 control register or system register nnnn: indirect pre- decrement register stc.l sr,@-rn mmmm: direct register control register or system register ldc rm,sr mmmm: indirect post-increment register control register or system register ldc.l @rm+,sr mmmm: indirect register ? jmp @rm m format xxxx mmmm xxxx xxxx 15 0 mmmm: pc relative using rm ? braf rm mmmm: direct register nnnn: direct register add rm,rn mmmm: direct register nnnn: indirect register mov.l rm,@rn mmmm: indirect post-increment register (multiply- and-accumulate) nnnn * : indirect post-increment register (multiply- and-accumulate) mach, macl mac.w @rm+,@rn+ mmmm: indirect post-increment register nnnn: direct register mov.l @rm+,rn mmmm: direct register nnnn: indirect pre- decrement register mov.l rm,@- rn nm format nnnn xxxx xxxx 15 0 mmmm mmmm: direct register nnnn: indirect indexed register mov.l rm,@(r0,rn)
rev. 2.00, 09/04, page 28 of 720 instruction formats source operand destination operand example md format xxxx dddd 15 0 mmmm xxxx mmmmdddd: indirect register with displacement r0 (direct register) mov.b @(disp,rn),r0 nd4 format xxxx xxxx dddd 15 0 nnnn r0 (direct register) nnnndddd: indirect register with displacement mov.b r0,@(disp,rn) mmmm: direct register nnnndddd: indirect register with displacement mov.l rm,@(disp,rn) nmd format nnnn xxxx dddd 15 0 mmmm mmmmdddd: indirect register with displacement nnnn: direct register mov.l @(disp,rm),rn dddddddd: indirect gbr with displacement r0 (direct register) mov.l @(disp,gbr),r0 r0 (direct register) dddddddd: indirect gbr with displacement mov.l r0,@(disp,gbr) dddddddd: pc relative with displacement r0 (direct register) mova @(disp,pc),r0 d format dddd xxxx 15 0 xxxx dddd ? dddddddd: pc relative bf label d12 format dddd xxxx 15 0 dddd dddd ? dddddddddddd: pc relative bra label (label = disp + pc) nd8 format dddd nnnn xxxx 15 0 dddd dddddddd: pc relative with displacement nnnn: direct register mov.l @(disp,pc),rn iiiiiiii: immediate indirect indexed gbr and.b #imm,@(r0,gbr) iiiiiiii: immediate r0 (direct register) and #imm,r0 i format xxxx xxxx i i i i 15 0 i i i i iiiiiiii: immediate ? trapa #imm ni format nnnn i i i i xxxx 15 0 i i i i iiiiiiii: immediate nnnn: direct register add #imm,rn note: * in multiply-and-accumula te instructions, nnnn is the source register.
rev. 2.00, 09/04, page 29 of 720 2.5 instruction set 2.5.1 instruction set by classification table 2.10 lists the instructions according to their classification. table 2.10 classification of instructions classification types operation code function no. of instructions mov data transfer, immediate data transfer, peripheral module data transfer, structure data transfer mova effective address transfer movt t bit transfer swap swap of upper and lower bytes data transfer 5 xtrct extraction of the middl e of registers connected 39 21 add binary addition 33 addc binary addition with carry addv binary addition with overflow check cmp/cond comparison div1 division arithmetic operations div0s initialization of signed division div0u initialization of unsigned division dmuls signed double-length multiplication dmulu unsigned double-length multiplication dt decrement and test exts sign extension extu zero extension mac multiply-and-accumulate, double-length multiply-and-accumulate operation mul double-length multiply operation muls signed multiplication mulu unsigned multiplication neg negation negc negation with borrow sub binary subtraction
rev. 2.00, 09/04, page 30 of 720 classification types operation code function no. of instructions subc binary subtraction with borrow arithmetic operations subv binary subtraction with underflow 6 and logical and 14 not bit inversion or logical or tas memory test and bit set tst logical and and t bit set logic operations xor exclusive or shift 10 rotl one-bit left rotation 14 rotr one-bit right rotation rotcl one-bit left rotation with t bit rotcr one-bit right rotation with t bit shal one-bit arithmetic left shift shar one-bit arithmetic right shift shll one-bit logical left shift shlln n-bit logical left shift shlr one-bit logical right shift shlrn n-bit logical right shift branch 9 bf conditional bran ch, conditional branch with delay (branch when t = 0) 11 bt conditional branch, conditional branch with delay (branch when t = 1) bra unconditional branch braf unconditional branch bsr branch to subroutine procedure bsrf branch to subroutine procedure jmp unconditional branch jsr branch to subroutine procedure rts return from subroutine procedure
rev. 2.00, 09/04, page 31 of 720 classification types operation code function no. of instructions 11 clrt t bit clear 31 system control clrmac mac register clear ldc load to control register lds load to system register nop no operation rte return from exception processing sett t bit set sleep transition to power-down mode stc store control register data sts store system register data trapa trap exception handling total: 62 142 the table below shows the format of instruction c odes, operation, and execution states. they are described by using this format according to their classification.
rev. 2.00, 09/04, page 32 of 720 instruction code format: item format explanation instruction described in mnemonic. op.sz src,dest op: operation code sz: size src: source dest: destination rm: source register rn: destination register imm: immediate data disp: displacement * 2 instruction code described in msb ? lsb order mmmm: source register nnnn: destination register 0000: r0 0001: r1 ? ? ? 1111: r15 iiii: immediate data dddd: displacement , direction of transfer (xx) memory operand m/q/t flag bits in the sr & logical and of each bit | logical or of each bit ^ exclusive or of each bit ~ logical not of each bit <>n n-bit right shift execution states ? value when no wait states are inserted * 1 t bit ? value of t bit after instruction is executed. an em-dash ( ? ) in the column means no change. notes: 1. instruction execution states: the execution states s hown in the table are minimums. the actual number of states may be incr eased when (1) contention occurs between instruction fetches and data access, or (2) when the destination register of the load instruction (memory register) equals to the register used by the next instruction. 2. depending on the operand size, displacement is scaled by 1, 2, or 4. for details, refer the sh-1/sh-2/sh-dsp programming manual .
rev. 2.00, 09/04, page 33 of 720 data transfer instructions: instruction instruction code operation execution states t bit mov #imm,rn 1110nnnniiiiiiii #imm sign extension rn 1 ? mov.w @(disp,pc),rn 1001nnnndddddddd (disp 2 + pc) sign extension rn 1 ? mov.l @(disp,pc),rn 1101nnnndddddddd (disp 4 + pc) rn 1 ? mov rm,rn 0110nnnnmmmm0011 rm rn 1 ? mov.b rm,@rn 0010nnnnmmmm0000 rm (rn) 1 ? mov.w rm,@rn 0010nnnnmmmm0001 rm (rn) 1 ? mov.l rm,@rn 0010nnnnmmmm0010 rm (rn) 1 ? mov.b @rm,rn 0110nnnnmmmm0000 (rm) sign extension rn 1 ? mov.w @rm,rn 0110nnnnmmmm0001 (rm) sign extension rn 1 ? mov.l @rm,rn 0110nnnnmmmm0010 (rm) rn 1 ? mov.b rm,@?rn 0010nnnnmmmm0100 rn?1 rn, rm (rn) 1 ? mov.w rm,@?rn 0010nnnnmmmm0101 rn?2 rn, rm (rn) 1 ? mov.l rm,@?rn 0010nnnnmmmm0110 rn?4 rn, rm (rn) 1 ? mov.b @rm+,rn 0110nnnnmmmm0100 (rm) sign extension rn,rm + 1 rm 1 ? mov.w @rm+,rn 0110nnnnmmmm0101 (rm) sign extension rn,rm + 2 rm 1 ? mov.l @rm+,rn 0110nnnnmmmm0110 (rm) rn,rm + 4 rm 1 ? mov.b r0,@(disp,rn) 10000000nnnndddd r0 (disp + rn) 1 ? mov.w r0,@(disp,rn) 10000001nnnndddd r0 (disp 2 + rn) 1 ? mov.l rm,@(disp,rn) 0001nnnnmmmmdddd rm (disp 4 + rn) 1 ? mov.b @(disp,rm),r0 10000100mmmmdddd (disp + rm) sign extension r0 1 ? mov.w @(disp,rm),r0 10000101mmmmdddd (disp 2 + rm) sign extension r0 1 ? mov.l @(disp,rm),rn 0101nnnnmmmmdddd (disp 4 + rm) rn 1 ? mov.b rm,@(r0,rn) 0000nnnnmmmm0100 rm (r0 + rn) 1 ? mov.w rm,@(r0,rn) 0000nnnnmmmm0101 rm (r0 + rn) 1 ? mov.l rm,@(r0,rn) 0000nnnnmmmm0110 rm (r0 + rn) 1 ?
rev. 2.00, 09/04, page 34 of 720 instruction instruction code operation execution states t bit mov.b @(r0,rm),rn 0000nnnnmmmm1100 (r0 + rm) sign extension rn 1 ? mov.w @(r0,rm),rn 0000nnnnmmmm1101 (r0 + rm) sign extension rn 1 ? mov.l @(r0,rm),rn 0000nnnnmmmm1110 (r0 + rm) rn 1 ? mov.b r0,@(disp,gbr) 11000000dddddddd r0 (disp + gbr) 1 ? mov.w r0,@(disp,gbr) 11000001dddddddd r0 (disp 2 + gbr) 1 ? mov.l r0,@(disp,gbr) 11000010dddddddd r0 (disp 4 + gbr) 1 ? mov.b @(disp,gbr),r0 11000100dddddddd (disp + gbr) sign extension r0 1 ? mov.w @(disp,gbr),r0 11000101dddddddd (disp 2 + gbr) sign extension r0 1 ? mov.l @(disp,gbr),r0 11000110dddddddd (disp 4 + gbr) r0 1 ? mova @(disp,pc),r0 11000111dddddddd disp 4 + pc r0 1 ? movt rn 0000nnnn00101001 t rn 1 ? swap.b rm,rn 0110nnnnmmmm1000 rm swap bottom two bytes rn 1 ? swap.w rm,rn 0110nnnnmmmm1001 rm swap two consecutive words rn 1 ? xtrct rm,rn 0010nnnnmmmm1101 rm: middle 32 bits of rn rn 1 ?
rev. 2.00, 09/04, page 35 of 720 arithmetic operation instructions: instruction instruction code operation execution states t bit add rm,rn 0011nnnnmmmm1100 rn + rm rn 1 ? add #imm,rn 0111nnnniiiiiiii rn + imm rn 1 ? addc rm,rn 0011nnnnmmmm1110 rn + rm + t rn, carry t 1 carry addv rm,rn 0011nnnnmmmm1111 rn + rm rn, overflow t 1 overflow cmp/eq #imm,r0 10001000iiiiiiii if r0 = imm, 1 t 1 comparison result cmp/eq rm,rn 0011nnnnmmmm0000 if rn = rm, 1 t 1 comparison result cmp/hs rm,rn 0011nnnnmmmm0010 if rn rm with unsigned data, 1 t 1 comparison result cmp/ge rm,rn 0011nnnnmmmm0011 if rn rm with signed data, 1 t 1 comparison result cmp/hi rm,rn 0011nnnnmmmm0110 if rn > rm with unsigned data, 1 t 1 comparison result cmp/gt rm,rn 0011nnnnmmmm0111 if rn > rm with signed data, 1 t 1 comparison result cmp/pl rn 0100nnnn00010101 if rn > 0, 1 t 1 comparison result cmp/pz rn 0100nnnn00010001 if rn 0, 1 t 1 comparison result cmp/str rm,rn 0010nnnnmmmm1100 if rn and rm have an equivalent byte, 1 t 1 comparison result div1 rm,rn 0011nnnnmmmm0100 single-step division (rn rm) 1 calculation result div0s rm,rn 0010nnnnmmmm0111 msb of rn q, msb of rm m, m ^ q t 1 calculation result div0u 0000000000011001 0 m/q/t 1 0 dmuls.l rm,rn 0011nnnnmmmm1101 signed operation of rn rm mach, macl 32 32 64 bits 2 to 4 * ? dmulu.l rm,rn 0011nnnnmmmm0101 unsigned operation of rn rm mach, macl 32 32 64 bits 2 to 4 * ?
rev. 2.00, 09/04, page 36 of 720 instruction instruction code operation execution states t bit dt rn 0100nnnn00010000 rn ? 1 rn, when rn is 0, 1 t. when rn is nonzero, 0 t 1 comparison result exts.b rm,rn 0110nnnnmmmm1110 byte in rm is sign- extended rn 1 ? exts.w rm,rn 0110nnnnmmmm1111 word in rm is sign- extended rn 1 ? extu.b rm,rn 0110nnnnmmmm1100 byte in rm is zero- extended rn 1 ? extu.w rm,rn 0110nnnnmmmm1101 word in rm is zero- extended rn 1 ? mac.l @rm+,@rn+ 0000nnnnmmmm1111 signed operation of (rn) (rm) + mac mac 32 32 + 64 64 bits 3/(2 to 4) * ? mac.w @rm+,@rn+ 0100nnnnmmmm1111 signed operation of (rn) (rm) + mac mac 16 16 + 64 64 bits 3/(2) * ? mul.l rm,rn 0000nnnnmmmm0111 rn rm macl, 32 32 32 bits 2 to 4 * ? muls.w rm,rn 0010nnnnmmmm1111 signed operation of rn rm macl 16 16 32 bits 1 to 3 * ? mulu.w rm,rn 0010nnnnmmmm1110 unsigned operation of rn rm macl 16 16 32 bits 1 to 3 * ? neg rm,rn 0110nnnnmmmm1011 0 ? rm rn 1 ? negc rm,rn 0110nnnnmmmm1010 0 ? rm ? t rn, borrow t 1 borrow sub rm,rn 0011nnnnmmmm1000 rn ? rm rn 1 ? subc rm,rn 0011nnnnmmmm1010 rn ? rm ? t rn, borrow t 1 borrow subv rm,rn 0011nnnnmmmm1011 rn ? rm rn, underflow t 1 overflow note: * the normal number of execution states is shown. (the number in parentheses is the number of states when there is contention with the precedin g or following instructions.)
rev. 2.00, 09/04, page 37 of 720 logic operation instructions: instruction instruction code operation execution states t bit and rm,rn 0010nnnnmmmm1001 rn & rm rn 1 ? and #imm,r0 11001001iiiiiiii r0 & imm r0 1 ? and.b #imm,@(r0,gbr) 11001101iiiiiiii (r0 + gbr) & imm (r0 + gbr) 3 ? not rm,rn 0110nnnnmmmm0111 ~rm rn 1 ? or rm,rn 0010nnnnmmmm1011 rn | rm rn 1 ? or #imm,r0 11001011iiiiiiii r0 | imm r0 1 ? or.b #imm,@(r0,gbr) 11001111iiiiiiii (r0 + gbr) | imm (r0 + gbr) 3 ? tas.b @rn 0100nnnn00011011 if (rn) is 0, 1 t; 1 msb of (rn) 4 test result tst rm,rn 0010nnnnmmmm1000 rn & rm; if the result is 0, 1 t 1 test result tst #imm,r0 11001000iiiiiiii r0 & imm; if the result is 0, 1 t 1 test result tst.b #imm,@(r0,gbr) 11001100iiiiiiii (r0 + gbr) & imm; if the result is 0, 1 t 3 test result xor rm,rn 0010nnnnmmmm1010 rn ^ rm rn 1 ? xor #imm,r0 11001010iiiiiiii r0 ^ imm r0 1 ? xor.b #imm,@(r0,gbr) 11001110iiiiiiii (r0 + gbr) ^ imm (r0 + gbr) 3 ?
rev. 2.00, 09/04, page 38 of 720 shift instructions: instruction instruction code operation execution states t bit rotl rn 0100nnnn00000100 t rn msb 1 msb rotr rn 0100nnnn00000101 lsb rn t 1 lsb rotcl rn 0100nnnn00100100 t rn t 1 msb rotcr rn 0100nnnn00100101 t rn t 1 lsb shal rn 0100nnnn00100000 t rn 0 1 msb shar rn 0100nnnn00100001 msb rn t 1 lsb shll rn 0100nnnn00000000 t rn 0 1 msb shlr rn 0100nnnn00000001 0 rn t 1 lsb shll2 rn 0100nnnn00001000 rn<<2 rn 1 ? shlr2 rn 0100nnnn00001001 rn>>2 rn 1 ? shll8 rn 0100nnnn00011000 rn<<8 rn 1 ? shlr8 rn 0100nnnn00011001 rn>>8 rn 1 ? shll16 rn 0100nnnn00101000 rn<<16 rn 1 ? shlr16 rn 0100nnnn00101001 rn>>16 rn 1 ?
rev. 2.00, 09/04, page 39 of 720 branch instructions: instruction instruction code operation execution states t bit bf label 10001011dddddddd if t = 0, disp 2 + pc pc; if t = 1, nop 3/1 * ? bf/s label 10001111dddddddd delayed branch, if t = 0, disp 2 + pc pc; if t = 1, nop 3/1 * ? bt label 10001001dddddddd if t = 1, disp 2 + pc pc; if t = 0, nop 3/1 * ? bt/s label 10001101dddddddd delayed branch, if t = 1, disp 2 + pc pc; if t = 0, nop 2/1 * ? bra label 1010dddddddddddd delayed branch, disp 2 + pc pc 2 ? braf rm 0000mmmm00100011 delayed branch, rm + pc pc 2 ? bsr label 1011dddddddddddd delayed branch, pc pr, disp 2 + pc pc 2 ? bsrf rm 0000mmmm00000011 delayed branch, pc pr, rm + pc pc 2 ? jmp @rm 0100mmmm00101011 delayed branch, rm pc 2 ? jsr @rm 0100mmmm00001011 delayed branch, pc pr, rm pc 2 ? rts 0000000000001011 delayed branch, pr pc 2 ? note: * one state when the pr ogram does not branch.
rev. 2.00, 09/04, page 40 of 720 system control instructions: instruction instruction code operation execution states t bit clrt 0000000000001000 0 t 1 0 clrmac 0000000000101000 0 mach, macl 1 ? ldc rm,sr 0100mmmm00001110 rm sr 1 lsb ldc rm,gbr 0100mmmm00011110 rm gbr 1 ? ldc rm,vbr 0100mmmm00101110 rm vbr 1 ? ldc.l @rm+,sr 0100mmmm00000111 (rm) sr, rm + 4 rm 3 lsb ldc.l @rm+,gbr 0100mmmm00010111 (rm) gbr, rm + 4 rm 3 ? ldc.l @rm+,vbr 0100mmmm00100111 (rm) vbr, rm + 4 rm 3 ? lds rm,mach 0100mmmm00001010 rm mach 1 ? lds rm,macl 0100mmmm00011010 rm macl 1 ? lds rm,pr 0100mmmm00101010 rm pr 1 ? lds.l @rm+,mach 0100mmmm00000110 (rm) mach, rm + 4 rm 1 ? lds.l @rm+,macl 0100mmmm00010110 (rm) macl, rm + 4 rm 1 ? lds.l @rm+,pr 0100mmmm00100110 (rm) pr, rm + 4 rm 1 ? nop 0000000000001001 no operation 1 ? rte 0000000000101011 delayed branch, stack area pc/sr 4 ? sett 0000000000011000 1 t 1 1 sleep 0000000000011011 sleep 3 * ? stc sr,rn 0000nnnn00000010 sr rn 1 ? stc gbr,rn 0000nnnn00010010 gbr rn 1 ? stc vbr,rn 0000nnnn00100010 vbr rn 1 ? stc.l sr,@?rn 0100nnnn00000011 rn ? 4 rn, sr (rn) 2 ? stc.l gbr,@?rn 0100nnnn00010011 rn ? 4 rn, gbr (rn) 2 ? stc.l vbr,@?rn 0100nnnn00100011 rn ? 4 rn, vbr (rn) 2 ? sts mach,rn 0000nnnn00001010 mach rn 1 ? sts macl,rn 0000nnnn00011010 macl rn 1 ? sts pr,rn 0000nnnn00101010 pr rn 1 ? sts.l mach,@?rn 0100nnnn00000010 rn ? 4 rn, mach (rn) 1 ? sts.l macl,@?rn 0100nnnn00010010 rn ? 4 rn, macl (rn) 1 ?
rev. 2.00, 09/04, page 41 of 720 instruction instruction code operation execution states t bit sts.l pr,@?rn 0100nnnn00100010 rn ? 4 rn, pr (rn) 1 ? trapa #imm 11000011iiiiiiii pc/sr stack area, (imm 4 + vbr) pc 8 ? note: * the number of execution states before the chip enters sleep mode: the execution states shown in the table are minimums. the actual number of states may be increased when (1) contention occurs between instruction fetches and data access, or (2) when the destination regi ster of the load instruction (memory register) equals to the register used by the next instruction.
rev. 2.00, 09/04, page 42 of 720 2.6 processing states 2.6.1 state transitions the cpu has five processing states: reset, excep tion processing, bus release, program execution and power-down. figure 2.4 shows the transitions between the states. from any state when res = 0 and hstby = 1 from any state when res = 1, mres = 0, and hstby = 1 res = 0 power-on reset state manual reset state program execution state bus release state sleep mode software standby mode hardware standby mode exception processing state when an internal power-on reset by wdt or internal manual reset by wdt occurs exception processing source occurs exception processing ends bus request generated bus request cleared ssby bit set for sleep instruction nmi interrupt or irq interrupt occurs power-down mode res = 1 res = 1, mres = 1 ssby bit cleared for sleep instruction from any state when res = 0 and hstby = 0 res = 0 hstby = 1 reset state bus request cleared bus request cleared bus request generated bus request generated figure 2.4 transitions between processing states
rev. 2.00, 09/04, page 43 of 720 reset state: the cpu resets in the reset state. when the res pin level goes low, the power-on reset state is entered. when the res pin is high and the mres pin is low, the manual reset state is entered. when the hstby pin is driven high and the res pin level goes low, the power-on reset state is entered. exception processing state : the exception processing state is a transient state that occurs when exception processing sources such as resets or in terrupts alter the cpu?s processing state flow. for a reset, the initial values of the program counter (pc) (ex ecution start address) and stack pointer (sp) are fetched from the exception pro cessing vector table and stored; the cpu then branches to the execution start addres s and execution of the program begins. for an interrupt, the stack pointer (sp) is acc essed and the program counter (pc) and status register (sr) are saved to the stack area. the ex ception service routine st art address is fetched from the exception processing vector table; the cpu then branches to that address and the program starts executing, thereby enteri ng the program execution state. program execution state : in the program execution state, the cpu sequentially executes the program. power-down state : in the power-down state, the cpu operation halts and power consumption declines. the sleep instru ction places the cpu in the sleep mo de or the software standby mode. if the hstby pin is driven low when the res pin is low, the cpu will enter the hardware standby mode. bus release state : in the bus release state, the cpu releas es access rights to the bus to the device that has requested them.
rev. 2.00, 09/04, page 44 of 720
rev. 2.00, 09/04, page 45 of 720 section 3 mcu operating modes 3.1 selection of operating modes this lsi has four operating modes and four clock modes. the operating mode is determined by the setting of md3?md0, and fwp pins. do not change these pins during lsi operation (while power is on). do not set these pins in the other way than the combination shown in table 3.1. table 3.1 selection of operating modes pin setting mode no. fwp md3 md2 md1 md0 mode name on-chip rom bus width of cs0 area * 1 mode 0 1 x x 0 0 mcu extension mode 0 not active 8-bit mode 1 * 3 1 x x 0 1 mcu extension mode 1 not active ? mode 2 1 x x 1 0 mcu extension mode 2 active set by bcr1 of bsc mode 3 1 x x 1 1 single chip mode active ? * 2 0 x x 0 0 set by bcr1 of bsc * 2 0 x x 0 1 boot mode * 2 active ? * 2 0 x x 1 0 set by bcr1 of bsc * 2 0 x x 1 1 user programming mode * 2 active ? notes: the symbol x means ?don?t care.? 1. the mode3 and an 8-bit space of mcu extension mode is supported. 2. programming mode for flash memory. supported in only f-ztat version. 3. cannot be used for this lsi. there are two modes as the mcu operating modes: mcu extension mode and single chip mode. there are two modes to program the flash memory (on-board programming mode): boot mode and user programming mode.
rev. 2.00, 09/04, page 46 of 720 the clock mode is selected by the input of md2 and md3 pins. table 3.2 maximum operating clock frequency for each clock mode pin setting md3 md2 maximum operat ing clock frequency 0 0 12.5 mhz (input clock 1 * , maximum of input clock: 12.5 mhz) 0 1 25 mhz (input clock 2 * , maximum of input clock: 12.5 mhz) 1 0 40 mhz (input clock 4 * , maximum of input clock: 10 mhz) 1 1 50 mhz (input clock 4 for system clock, input clock 2 for peripheral clock, maximum of input clock: 12.5 mhz) note: * the frequencies for the system and peripheral module clocks are the same. 3.2 input/output pins table 3.3 describes the configuration of operating mode related pins. table 3.3 operating mode pin configuration pin name input/output function md0 input designates operating mode through the level applied to this pin md1 input designates operating mode through the level applied to this pin md2 input designates clock mode through the level applied to this pin md3 input designates clock mode through the level applied to this pin fwp input pin for the hardware protec tion against programming/erasing the on-chip flash memory
rev. 2.00, 09/04, page 47 of 720 3.3 explanation of operating modes 3.3.1 mode 0 (mcu extension mode 0) cs0 area becomes an external memory space with 8-bit bus width in this mode. 3.3.2 mode 1 (mcu extension mode 1) this mode is not supported in this lsi. 3.3.3 mode 2 (mcu extension mode 2) the on-chip rom is active and cs0 area can be used in this mode. 3.3.4 mode 3 (single chip mode) all ports can be used in this mode, however the external address cannot be used. 3.3.5 clock mode the input waveform frequency can be used as is, doubled or quadrupled as system clock frequency in mode 0 to mode 3.
rev. 2.00, 09/04, page 48 of 720 3.4 address map the address map for the operating modes are shown in figures 3.1 and 3.2. rom: 256 kbytes, ram: 12 kbytes h'00000000 h'ffff7fff h'ffff8000 h'0003ffff h'00040000 h'ffffbfff h'ffffc000 cs0 area cs0 area on-chip peripheral i/o registers on-chip ram reserved area reserved area reserved area reserved area reserved area h'ffffffff h'ffffcfff h'ffffd000 h'00000000 h'ffff7fff h'ffff8000 h'0003ffff h'00000000 h'0003ffff h'00040000 h'001fffff h'00200000 h'0023ffff h'00240000 h'ffffbfff h'ffffc000 h'ffffffff h'ffffcfff h'ffffd000 h'ffff8000 h'ffffbfff h'ffffffff h'ffffd000 on-chip rom on-chip rom on-chip ram on-chip peripheral i/o registers on-chip ram on-chip peripheral i/o registers mode 0 mode 2 mode 3 figure 3.1 the address map for the operati ng modes of sh7047 flash memory version
rev. 2.00, 09/04, page 49 of 720 rom: 128 kbytes, ram: 8 kbytes h'00000000 h'ffff7fff h'ffff8000 h'0003ffff h'00040000 h'ffffbfff h'ffffc000 cs0 area cs0 area on-chip peripheral i/o registers on-chip ram reserved area reserved area reserved area reserved area reserved area h'ffffffff h'ffffdfff h'ffffe000 h'00000000 h'ffff7fff h'ffff8000 h'0001ffff h'00000000 h'0001ffff h'00020000 h'001fffff h'00200000 h'0023ffff h'00240000 h'ffffbfff h'ffffc000 h'ffffffff h'ffffdfff h'ffffe000 h'ffff8000 h'ffffbfff h'ffffffff h'ffffe000 on-chip rom on-chip rom on-chip ram on-chip peripheral i/o registers on-chip ram on-chip peripheral i/o registers mode 0 mode 2 mode 3 figure 3.2 the address map for the opera ting modes of sh7049 mask rom version
rev. 2.00, 09/04, page 50 of 720 3.5 initial state of this lsi in this lsi, some on-chip modules are set to module standby state as its initial state for power down. therefore, to operate those modules, it is necessary to clear module standby state. for details, refer to section 24, power-down modes.
rev. 2.00, 09/04, page 51 of 720 section 4 clock pulse generator this lsi has an on-chip clock pulse generator (cpg) that generates the system clock ( ) and peripheral clock (p ) to generate the internal clock ( /2 to /8192, p /2 to p /1024). the cpg consists of an oscillator, pll ci rcuit, and pre-scaler. a block diagram of the clock pulse generator is shown in figure 4.1. the frequency from the oscillator can be modified by the pll circuit. pllcap extal xtal md2 md3 ck pre-scaler pre-scaler oscillator pll circuit clock divider ( 1/2) clock mode control circuit within the lsi /2 to /8192 /2 (hcan2) p p /2 to p /1024 figure 4.1 block diagram of the clock pulse generator
rev. 2.00, 09/04, page 52 of 720 4.1 oscillator clock pulses can be supplied from a connected crystal resonator or an external clock. 4.1.1 connecting a crystal resonator circuit configuration: a crystal resonator can be connected as shown in figure 4.2. use the damping resistance (rd) listed in table 4.1. use an at-cut parallel-resonance type crystal resonator that has a resonance frequency of 4 to 12.5 mhz. it is recommended to consult crystal dealer concerning the compatibility of the crystal resonator and the lsi. extal xtal r d c l2 c l1 c l1 = c l2 = 18?22 pf (recommended value) figure 4.2 connection of the crystal resonator (example) table 4.1 damping resistance values frequency (mhz) 4 8 10 12.5 rd ( ? ) 500 200 0 0 crystal resonator: figure 4.3 shows an equivalent circuit of the crystal resonator. use a crystal resonator with the characteristics listed in table 4.2. xtal at-cut parallel-resonance type c l extal c 0 l r s figure 4.3 crystal resonator equivalent circuit table 4.2 crystal resonator characteristics frequency (mhz) 4 8 10 12.5 rs max ( ? ) 120 80 60 50 c 0 max (pf) 7 7 7 7
rev. 2.00, 09/04, page 53 of 720 4.1.2 external clock input method figure 4.4 shows an example of an external clock input connection. in this case, make the external clock high level to stop it in standby mode. during operation, make the external input clock frequency 4 to 12.5 mhz. when leaving the xtal pin open, make sure the stray capacitance is less than 10 pf. even when inputting an external clock, be sure to wait at least the oscillation stabilization time in power-on sequence or in releasing standby mode, in order to ensure the pll stabilization time. extal xtal external clock input open state figure 4.4 example of external clock connection
rev. 2.00, 09/04, page 54 of 720 4.2 function for detecting the oscillator halt this cpg can detect a clock halt and automati cally cause the timer pins to become high- impedance when any system abnormality causes the os cillator to halt. that is, when a change of extal has not been detected, the high-current 12 pins (pe9/tioc3b, pe11/tioc3d, pe12/tioc4a, pe13/tioc4b/ mres , pe14/tioc4c, pe15/tioc4d/ irqout , pe16/puoa/ ubctrg */a10, pe17/pvoa/wait/a11, pe18/pwoa/a12, pe19/puob/rxd4/ a13, pe20/pvob/txd4/a14, pe21/pwob/sck4/a15) are set to high-impedance regardless of pfc setting. even in standby mode, these 12 pins become high-impedance regardless of pfc setting. these pins enter the normal state after standby mode is released. when abnormalities that halt the oscillator occur except in standby mode, other lsi operations become undefined. in this case, lsi operations, including these 12 pins, become undefined even when the oscillator operation starts again. note: * for flash version only
rev. 2.00, 09/04, page 55 of 720 4.3 usage notes 4.3.1 note on crystal resonator a sufficient evaluation at the user?s site is nece ssary to use the lsi, by referring the resonator connection examples shown in this section, because various charact eristics related to the crystal resonator are closely linked to the user?s board design. as the resonator circuit constants will depend on the resonator and the floating capacitance of the mounting circuit, the component value should be determined in consultation with the resonator manufacturer. ensure that a voltage exceeding the maximum rati ng is not applied to the oscillator pin. 4.3.2 notes on board design when using a crystal oscillator, place the crystal oscillator and its load ca pacitors as close as possible to the xtal and extal pins. do not route any signal lines near the oscillator circuitry as shown in figure 4.5. otherwise, correct oscillation can be interfered by induction. measures against radiation noise are taken in this lsi. if radiation noise needs to be further reduced, usage of a multi-layer printed circui t board with ground planes is recommended. c l2 signal a signal b this lsi c l1 xtal extal avoid figure 4.5 cautions for oscillator circuit system board design
rev. 2.00, 09/04, page 56 of 720 a circuitry shown in figure 4.6 is recommended as an external circuitry around the pll. place oscillation stabilization capacitor c1 close to the pllcap pin, and ensure that no other signal lines cross this line. separate pllvcl and p llvss circuit against vcc and vss circuit from the board power supply source, and be sure to insert bypass capacitors cb and cpb close to the pins. pllcap pllv cl pllv ss v cc v ss c1: 470 pf r1: 3k ? cpb = 0.47 f * cb = 0.47 f * (values are recommended values.) note: * cb and cpb are laminated ceramic type. figure 4.6 recommended ext ernal circuitry around the pll electromagnetic waves are radiated from an lsi in operation. this lsi has an electromagnetic peak in the harmonics band whose primary frequ ency is determined by the lower frequency between the system clock ( ) and peripheral clock (p ). for example, when = 50 mhz and p = 40 mhz, the primary frequency is 40 mhz. if th is lsi is used adjacent to a device sensitive to electromagnetic interference, e.g. fm/vhf band r eceiver, a printed circuit board of more than four layers with planes exclusivel y for system ground is recommended.
rev. 2.00, 09/04, page 57 of 720 section 5 exception processing 5.1 overview 5.1.1 types of exception processing and priority exception processing is started by four sources: resets, address errors, interrupts and instructions and have the priority, as shown in table 5.1. when several exception processing sources occur at once, they are processed according to the priority. table 5.1 types of exceptio n processing and priority exception source priority power-on reset reset manual reset cpu address error and aud address error * 1 address error dtc address error nmi user break h-udi * 1 irq interrupt on-chip peripheral modules: ? multifunction timer unit (mtu) ? a/d converter 0 and 1 (a/d0, a/d1) ? data transfer controller (dtc) ? compare match timer 0 and 1 (cmt0, cmt1) ? watchdog timer (wdt) ? input/output port (i/o) (mtu) ? serial communication interface 2, 3, and 4 (sci2, sci3, and sci4) ? motor management timer (mmt) ? input/output port (i/o) (mmt) ? controller area network 2 (hcan 2) trap instruction (trapa instruction) general illegal instructions (undefined code) high instructions illegal slot instructions (undefined code placed directly after a delay branch instruction * 2 or instructions that rewrite the pc * 3 ) low notes: 1. for flash version only 2. delayed branch instructions: jmp, jsr, bra, bsr, rts, rte, bf/s, bt/s, bsrf, and braf. 3. instructions that rewrite the pc: jmp, jsr, bra, bsr, rts, rte, bt, bf, trapa, bf/s, bt/s, bsrf, and braf.
rev. 2.00, 09/04, page 58 of 720 5.1.2 exception processing operations the exception processing sources are detected an d the processing starts according to the timing shown in table 5.2. table 5.2 timing for exception source det ection and start of exception processing exception source timing of source de tection and start of processing power-on reset starts when the res pin changes from low to high or when wdt overflows. reset manual reset starts when the mres pin changes from low to high. address error interrupts detected when instruction is decoded and starts when the execution of the previous instruction is completed. trap instruction starts from the execution of a trapa instruction. general illegal instructions starts from the decoding of undefined code anytime except after a delayed branch instruction (delay slot). instructions illegal slot instructions starts from the decoding of u ndefined code placed in a delayed branch instruction (delay slot) or of instructions that rewrite the pc. when exception processing starts , the cpu operates as follows: 1. exception processing triggered by reset: the initial values of the program counter (pc) and stack pointer (sp) are fetched from the exception processing vector table (pc and sp are respectively the h'00000000 and h'00000004 addresses for power-on resets and the h'00000008 and h'0000000c addresses for manual resets). see section 5.1.3, exception pr ocessing vector table, for more information. h'00000000 is then written to the vector base register (vbr) , and h'f (b'1111) is written to the interrupt mask bits (i3 to i0) of the status register (sr). the program begins running from the pc address fetched from the ex ception processing vector table. 2. exception processing triggered by address errors, interrupts and instructions: sr and pc are saved to the stack indicated by r15. for interrupt exception processing, the interrupt priority level is written to the sr?s in terrupt mask bits (i3 to i0). for address error and instruction exception processing, the i3 to i0 bits are not affected. th e start address is then fetched from the exception processing vector table and the program begins running from that address.
rev. 2.00, 09/04, page 59 of 720 5.1.3 exception processing vector table before exception processing begins running, the exception processing vector table must be set in memory. the exception processing vector table st ores the start addresses of exception service routines. (the reset exception processing table holds the initial values of pc and sp.) all exception sources are given different vector numbers and vector tabl e address offsets. the vector table addresses are calculated from these v ector numbers and vector table address offsets. during exception processing, the start addresses of the exception service r outines are fetched from the exception processing vector table that is indicated by this vector table address. table 5.3 shows the vector numbers and vector table address offsets. table 5.4 shows how vector table addresses are calculated. table 5.3 exception processing vector table exception sources vector numbers vector table address offset power-on reset pc 0 h'00000000 to h'00000003 sp 1 h'00000004 to h'00000007 manual reset pc 2 h'00000008 to h'0000000b sp 3 h'0000000c to h'0000000f general illegal instructio n 4 h'00000010 to h'00000013 (reserved by system) 5 h'00000014 to h'00000017 slot illegal instruction 6 h'00000018 to h'0000001b (reserved by system) 7 h'0000001c to h'0000001f 8 h'00000020 to h'00000023 cpu address error and aud address error * 1 9 h'00000024 to h'00000027 dtc address error 10 h'00000028 to h'0000002b interrupts nmi 11 h'0000002c to h'0000002f user break 12 h'00000030 to h'00000033 (reserved by system) 13 h'00000034 to h'00000037 h-udi * 1 14 h'00000038 to h'0000003b (reserved by system) 15 : 31 h'0000003c to h'0000003f : h'0000007c to h'0000007f trap instruction (user vector) 32 : 63 h'00000080 to h'00000083 : h'000000fc to h'000000ff
rev. 2.00, 09/04, page 60 of 720 exception sources vector numbers vector table address offset interrupts irq0 64 h'00000100 to h'00000103 irq1 65 h'00000104 to h'00000107 irq2 66 h'00000108 to h'0000010b irq3 67 h'0000010c to h'0000010f reserved by system 68 h'00000110 to h'00000113 reserved by system 69 h'00000114 to h'00000117 reserved by system 70 h'00000118 to h'0000011b reserved by system 71 h'0000011c to h'0000011f on-chip peripheral module * 2 72 : 255 h'00000120 to h'00000123 : h'000003fc to h'000003ff notes: 1. for flash version only 2. the vector numbers and vector table address offsets for each on-chip peripheral module interrupt are given in section 6, interrupt controller (i ntc), and table 6.2, interrupt exception sources, vector addresses and priorities. table 5.4 calculating exception processing vector table addresses exception source vector table address calculation resets vector table address = (vector table address offset) = (vector number) 4 address errors, interrupts, instructions vector table address = vbr + (vector table address offset) = vbr + (vector number) 4 notes: 1. vbr: vector base register 2. vector table address offset: see table 5.3. 3. vector number: see table 5.3.
rev. 2.00, 09/04, page 61 of 720 5.2 resets 5.2.1 types of reset resets have the highest priority of any exception source. there are two types of resets: manual resets and power-on resets. as table 5.5 shows, both types of resets initialize the internal status of the cpu. in power-on resets, all registers of th e on-chip peripheral modu les are initialized; in manual resets, they are not. table 5.5 reset status conditions for transition to reset status internal status type res wdt overflow mres cpu/intc on-chip peripheral module pfc, io port low ? ? initialized initialized initialized power-on reset high overflow high initialized initialized not initialized manual reset high ? low initialized not initialized not initialized 5.2.2 power-on reset power-on reset by res pin: when the res pin is driven low, the lsi becomes to be a power- on reset state. to reliably reset the lsi, the res pin should be kept at low for at least the duration of the oscillation settling time when applying power or when in standby mode (when the clock circuit is halted) or at least 20 t cyc when the clock circuit is running. during power-on reset, cpu internal status and all registers of on-chip peripheral modules are initialized. see appendix b, pin states, for the status of individual pins during the power-on reset status. in the power-on reset status, power-on re set exception processing starts when the res pin is first driven low for a set period of time and then re turned to high. the cpu will then operate as follows: 1. the initial value (execution start address) of the program counter (pc) is fetched from the exception processing vector table. 2. the initial value of the stack pointer (sp) is fetched from the exception processing vector table. 3. the vector base register (vbr) is cleared to h'00000000 and the interrupt mask bits (i3 to i0) of the status register (sr) are set to h'f (b'1111). 4. the values fetched from the exception processing vector table are set in pc and sp, then the program begins executing. be certain to always perform power-on reset processing when turning the system power on.
rev. 2.00, 09/04, page 62 of 720 power-on reset by wdt: when a setting is made for a power-on reset to be generated in the wdt?s watchdog timer mode, and the wdt?s tcnt overflows, the lsi becomes to be a power- on reset state. the pin function controller (pfc) registers and i/o port registers are not initialized by the reset signal generated by the wdt (these registers are initialized only by a power-on reset from outside of the chip). if reset caused by the input signal at the res pin and a reset caused by wdt overflow occur simultaneously, the res pin reset has priority, and the wovf bit in rstcsr is cleared to 0. when wdt-initiated power-on reset processing is started, the cpu operates as follows: 1. the initial value (execution start address) of the program counter (pc) is fetched from the exception processing vector table. 2. the initial value of the stack pointer (sp) is fetched from the exception processing vector table. 3. the vector base register (vbr) is cleared to h'00000000 and the interrupt mask bits (i3-i0) of the status register (sr) are set to h'f (b'1111). 4. the values fetched from the exception processi ng vector table are set in the pc and sp, then the program begins executing. 5.2.3 manual reset when the res pin is high and the mres pin is driven low, the lsi enters a manual reset state. to reliably reset the lsi, the mres pin should be kept at low for at least the duration of the oscillation settling time that is set in wdt in standby mode (when the clock is halted) or at least 20 t cyc when the clock is operating. during manual re set, the cpu internal status is initialized. registers of on-chip peripheral modules are not initialized. when the lsi enters manual reset status in the middle of a bus cycle, manual rese t exception proces sing does not start until the bus cycle has ended. thus, manual resets do not abort bus cycles. however, once mres is driven low, hold the low level until the cpu becomes to be a manual reset mode after the bus cycle ends. (keep at low level for at least the longest bus cycl e). see appendix b, pin states, for the status of individual pins during manual reset mode. in the manual reset status, manual reset exception processing starts when the mres pin is first kept low for a set period of time and then returned to high. the cpu will th en operate in the same procedures as described for power-on resets.
rev. 2.00, 09/04, page 63 of 720 5.3 address errors 5.3.1 the cause of address error exception address errors occur when instructions are fetched or data is read or written, as shown in table 5.6. table 5.6 bus cycles and address errors bus cycle type bus master bus cycl e description address errors cpu instruction fetched from even address none (normal) instruction fetched from odd address address error occurs instruction fetched from other than on-chip peripheral module space * none (normal) instruction fetched from on-chip peripheral module space * address error occurs instruction fetch instruction fetched from external memory space when in single chip mode address error occurs word data accessed from even address none (normal) word data accessed from odd address address error occurs longword data accessed from a longword boundary none (normal) longword data accessed from other than a long-word boundary address error occurs byte or word data accessed in on-chip peripheral module space * none (normal) longword data accessed in 16-bit on-chip peripheral module space * none (normal) longword data accessed in 8-bit on-chip peripheral module space * address error occurs data read/write cpu, dtc, or aud external memory space accessed when in single chip mode address error occurs note: * see section 9, bus state controller (bsc) for more information on the on-chip peripheral module space.
rev. 2.00, 09/04, page 64 of 720 5.3.2 address error exception processing when an address error occurs, the bus cycle in wh ich the address error occu rred ends, the current instruction finishes, and then address error ex ception processing starts. the cpu operates as follows: 1. the status register (sr) is saved to the stack. 2. the program counter (pc) is saved to the stack. the pc value saved is the start address of the instruction to be executed after the last executed instruction. 3. the start address of the exception service rou tine is fetched from the exception processing vector table that corres ponds to the occurred ad dress error, and the pr ogram starts executing from that address. the jump in this case is not a delayed branch.
rev. 2.00, 09/04, page 65 of 720 5.4 interrupts 5.4.1 interrupt sources table 5.7 shows the sources that start the interrupt exception pr ocessing. they are nmi, user breaks, h-udi, irq and on-chip peripheral modules. table 5.7 interrupt sources type request source number of sources nmi nmi pin (external input) 1 user break user break controller 1 h-udi high-performance user debug interface 1 irq irq0 to irq3 pins (external input) 4 on-chip peripheral module multifunction timer unit 23 data transfer controller 1 compare match timer 2 a/d converter (a/d0 and a/d1) 2 serial communication interface 12 watchdog timer 1 motor management timer 2 controller area network 2 4 input/output port 2 each interrupt source is allocated a different vector number and vect or table offset. see section 6, interrupt controller (intc), and table 6.2, interrupt exception sources, vector addresses and priorities, for more information on vector numbers and vector table address offsets.
rev. 2.00, 09/04, page 66 of 720 5.4.2 interrupt priority level the interrupt priority is predetermined. wh en multiple interrupts occur simultaneously (overlapped interruptions), the interrupt controller (intc) determines their relative priorities and starts the exception processi ng according to the results. the priority of interrupts is expressed as priority levels 0 to 16, with priority 0 the lowest and priority 16 the highest. the nmi interrupt has prio rity 16 and cannot be masked, so it is always accepted. the priority level of us er break interrupt and h-udi is 15. irq interrupts and on-chip peripheral module interrupt priority levels can be set freely using the intc?s interrupt priority level setting registers a, d to i, and k (ipra, iprd to ipri, and iprk) as shown in table 5.8. the priority levels that can be set are 0 to 15. level 16 cannot be set. see section 6.3.4, interrupt priority registers a, d to i, k (ipra, iprd to ipri, iprk), for more information on ipra to iprk. table 5.8 interrupt priority type priority level comment nmi 16 fixed priority level. cannot be masked. user break 15 fixed priority level. h-udi 15 fixed priority level. irq on-chip peripheral module 0 to 15 set with interrupt priority level setting registers a through k (ipra to iprk). 5.4.3 interrupt exce ption processing when an interrupt occurs, the interrupt controller (intc) ascertains its priority level. nmi is always accepted, but other interrupts are only accepted if they have a priority level higher than the priority level set in the interrupt mask bits (i3 to i0) of the status register (sr). when an interrupt is accepted, ex ception processing begins. in in terrupt exception processing, the cpu saves sr and the program counter (pc) to th e stack. the priority level value of the accepted interrupt is written to sr bits i3 to i0. for nmi, however, the priority level is 16, but the value set in i3 to i0 is h'f (level 15). next, the start addr ess of the exception service routine is fetched from the exception proces sing vector table for the accepted interr upt, that address is jumped to and execution begins. see section 6.6, interrupt operation, for more information on the interrupt exception processing.
rev. 2.00, 09/04, page 67 of 720 5.5 exceptions triggered by instructions 5.5.1 types of exceptions triggered by instructions exception processing can be triggered by trap instruction, illegal slot instructions, and general illegal instructions, as shown in table 5.9. table 5.9 types of exceptions triggered by instructions type source instruction comment trap instruction trapa ? illegal slot instructions undefined code placed immediately after a delayed branch instruction (delay slot) or instructions that rewrite the pc delayed branch instructions: jmp, jsr, bra, bsr, rts, rte, bf/s, bt/s, bsrf, braf instructions that rewrite the pc: jmp, jsr, bra, bsr, rts, rte, bt, bf, trapa, bf/s, bt/s, bsrf, braf general illegal instructions undefined code anywhere besides in a delay slot ? 5.5.2 trap instructions when a trapa instruction is ex ecuted, trap instruction excepti on processing starts. the cpu operates as follows: 1. the status register (sr) is saved to the stack. 2. the program counter (pc) is saved to the stack. the pc value saved is the start address of the instruction to be executed after the trapa instruction. 3. the cpu reads the start address of the excepti on service routine from th e exception processing vector table that corres ponds to the vector numb er specified in the tr apa instruction, jumps to that address and starts excuting the prog ram. this jump is not a delayed branch.
rev. 2.00, 09/04, page 68 of 720 5.5.3 illegal slot instructions an instruction placed imme diately after a delayed branch instru ction is called ?instruction placed in a delay slot?. when the instruction placed in th e delay slot is an unde fined code, illegal slot exception processing starts after the undefined code is decoded. illegal slot exception processing also starts when an instruction th at rewrites the program counter (p c) is placed in a delay slot and the instruction is decoded. the cpu handles an illegal slot instruction as follows: 1. the status register (sr) is saved to the stack. 2. the program counter (pc) is saved to the stack. the pc value saved is the target address of the delayed branch instruction immediately before the undefined code or the instruction that rewrites the pc. 3. the start address of the exception service rou tine is fetched from the exception processing vector table that corres ponds to the exception that occurred. that address is jumped to and the program starts executing. the jump in this case is not a delayed branch. 5.5.4 general illegal instructions when undefined code placed anywhere other than immediately after a delayed branch instruction (i.e., in a delay slot) is decoded, general illega l instruction exception processing starts. the cpu handles the general illegal instructions in the same procedures as in the illegal slot instructions. unlike processing of illegal slot instructions, however, the program counter value that is stacked is the start address of the undefined code.
rev. 2.00, 09/04, page 69 of 720 5.6 cases when exception sources are not accepted when an address error or interrupt is generated directly after a delayed branch instruction or interrupt-disabled instruction, it is sometimes no t accepted immediately but stored instead, as shown in table 5.10 . in this case, it will be accepted when an instruction that can accept the exception is decoded. table 5.10 generation of exception sources immediatel y after a delayed branch instruction or interrup t-disabled instruction exception source point of occurrence address error interrupt immediately after a delayed branch instruction * 1 not accepted not accepted immediately after an interrupt-disabled instruction * 2 accepted not accepted notes: 1. delayed branch instructions: jmp, js r, bra, bsr, rts, rte, bf/s, bt/s, bsrf, and braf 2. interrupt-disabled instructions: ldc, ldc. l, stc, stc.l, lds, lds.l, sts, and sts.l 5.6.1 immediately after a delayed branch instruction when an instruction placed immediat ely after a delayed branch instru ction (delay slot) is decoded, neither address errors nor interrupts are accept ed. the delayed branch instruction and the instruction placed immediately af ter it (delay slot) are always executed consecutively, so no exception processing occurs during this period. 5.6.2 immediately after an interrupt-disabled instruction when an instruction placed imme diately after an interrupt-disab led instruction is decoded, interrupts are not accep ted. address errors can be accepted.
rev. 2.00, 09/04, page 70 of 720 5.7 stack status after exception processing ends the status of the stack after exception processing ends is shown in table 5.11. table 5.11 stack st atus after exception processing ends types stack status address error 32 bits 32 bits sr address of instruction after executed instruction sp trap instruction 32 bits 32 bits sr address of instruction after trapa instruction sp general illegal instruction 32 bits 32 bits sr address of instruction after general illegal instruction sp interrupt 32 bits 32 bits sr address of instruction after executed instruction sp illegal slot instruction 32 bits 32 bits sr jump destination address of delay branch instruction sp
rev. 2.00, 09/04, page 71 of 720 5.8 usage notes 5.8.1 value of stack pointer (sp) the value of the stack pointer must always be a mu ltiple of four. if it is not, an address error will occur when the stack is accessed during exception processing. 5.8.2 value of vector base register (vbr) the value of the vector base register must always be a multiple of four. if it is not, an address error will occur when the stack is acce ssed during exception processing. 5.8.3 address errors caused by stacking of address error exception processing when the value of the stack pointer is not a multip le of four, an address error will occur during stacking of the exception processi ng (interrupts, etc.) and addres s error exception processing will start after the first exception proces sing is ended. address errors wi ll also occur in the stacking for this address error exception processing. to ensure that address error excep tion processing does not go into an endless loop , no address errors are accepted at that point. this allows program control to be shifted to the service routine for addres s error exception and en ables error processing. when an address error occurs during exception pr ocessing stacking, the stacking bus cycle (write) is executed. during stacking of th e status register (sr) and program counter (pc), the value of sp is reduced by 4 for both of sr and pc, therefore th e value of sp is still not a multiple of four after the stacking. the address value output during stacki ng is the sp value, so the address itself where the error occurred is output. this means that the write data stacked is undefined.
rev. 2.00, 09/04, page 72 of 720
rev. 2.00, 09/04, page 73 of 720 section 6 interrupt controller (intc) the interrupt controller (intc) ascertains the prior ity of interrupt sources and controls interrupt requests to the cpu. 6.1 features ? 16 levels of interrupt priority ? nmi noise canceler function ? occurrence of interrupt can be reported externally ( irqout pin) figure 6.1 shows a block diagram of the intc.
rev. 2.00, 09/04, page 74 of 720 irqout nmi irq0 irq1 irq2 irq3 ubc h-udi dtc mtu cmt mmt a/d sci wdt hcan2 i/o (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) input control com- parator interrupt request sr cpu i3 i2 i1 i0 internal bus bus interface ipra to iprk icr1 isr icr2 module bus intc sci: serial communications interface wdt: watchdog timer hcan2: controller area network 2 i/o: i/o port (port output controller) icr1, icr2: interrupt control register isr: irq status register ipra to iprk: interrupt priority level setting registers a to k sr: status register ipr dter dtc ubc: user break controller h-udi: high-performance user debug interface dtc: data transfer controller mtu: multifunction timer unit cmt: compare match timer mmt: motor management timer a/d: a/d converter cpu/dtc request determination priority determination figure 6.1 intc block diagram
rev. 2.00, 09/04, page 75 of 720 6.2 input/output pins table 6.1 shows the intc pin configuration. table 6.1 pin configuration name abbreviation i/o function non-maskable interrupt input pin nmi i input of non-maskable interrupt request signal interrupt request input pins irq0 to irq3 i input of maskable interrupt request signals interrupt request output pin irqout o output of notification signal when an interrupt has occurred 6.3 register descriptions the interrupt controller has the following registers. for details on register addresses and register states during each processing, refer to appendix a, internal i/o register. ? interrupt control register 1 (icr1) ? interrupt control register 2 (icr2) ? irq status register (isr) ? interrupt priority register a (ipra) ? interrupt priority register d (iprd) ? interrupt priority register e (ipre) ? interrupt priority register f (iprf) ? interrupt priority register g (iprg) ? interrupt priority register h (iprh) ? interrupt priority register i (ipri) ? interrupt priority register k (iprk)
rev. 2.00, 09/04, page 76 of 720 6.3.1 interrupt contro l register 1 (icr1) icr1 is a 16-bit register that sets the input signal detection mode of the external interrupt input pins nmi and irq0 to irq3 and indicates the input signal level at the nmi pin. bit bit name initial value r/w description 15 nmil 1/0 r nmi input level sets the level of the signal input to the nmi pin. this bit can be read to determine the nmi pin level. this bit cannot be modified. 0: nmi input level is low 1: nmi input level is high 14 to 9 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 8 nmie 0 r/w nmi edge select 0: interrupt request is detected on falling edge of nmi input 1: interrupt request is detected on rising edge of nmi input 7 irq0s 0 r/w irq0 sense select this bit sets the irq0 interrupt request detection mode. 0: interrupt request is detected on low level of irq0 input 1: interrupt request is detected on edge of irq0 input (edge direction is selected by icr2) 6 irq1s 0 r/w irq1 sense select this bit sets the irq1 interrupt request detection mode. 0: interrupt request is detected on low level of irq1 input 1: interrupt request is detected on edge of irq1 input (edge direction is selected by icr2)
rev. 2.00, 09/04, page 77 of 720 bit bit name initial value r/w description 5 irq2s 0 r/w irq2 sense select this bit sets the irq2 interrupt request detection mode. 0: interrupt request is detected on low level of irq2 input 1: interrupt request is detected on edge of irq2 input (edge direction is selected by icr2) 4 irq3s 0 r/w irq3 sense select this bit sets the irq3 interrupt request detection mode. 0: interrupt request is detected on low level of irq3 input 1: interrupt request is detected on edge of irq3 input (edge direction is selected by icr2) 3 to 0 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 6.3.2 interrupt contro l register 2 (icr2) icr2 is a 16-bit register that sets the edge detection mode of the external interrupt input pins irq0 to irq3. icr2 is, however, valid only when irq interrupt request detection mode is set to the edge detection mode by the sense select bits of irq0 to irq 3 in interrupt control register 1 (icr1). if the irq interrupt request detection mode has been set to low level detection mode, the setting of icr2 is ignored. bit bit name initial value r/w description 15 14 irq0es1 irq0es0 0 0 r/w r/w this bit sets the irq0 interrupt request edge detection mode. 00: interrupt request is detected on falling edge of irq0 input 01: interrupt request is detected on rising edge of irq0 input 10: interrupt request is detected on both of falling and rising edge of irq0 input 11: cannot be set
rev. 2.00, 09/04, page 78 of 720 bit bit name initial value r/w description 13 12 irq1es1 irq1es0 0 0 r/w r/w this bit sets the irq1 interrupt request edge detection mode. 00: interrupt request is detected on falling edge of irq1 input 01: interrupt request is detected on rising edge of irq1 input 10: interrupt request is detected on both of falling and rising edge of irq1 input 11: cannot be set 11 10 irq2es1 irq2es0 0 0 r/w r/w this bit sets the irq2 interrupt request edge detection mode. 00: interrupt request is detected on falling edge of irq2 input 01: interrupt request is detected on rising edge of irq2 input 10: interrupt request is detected on both of falling and rising edge of irq2 input 11: cannot be set 9 8 irq3es1 irq3es0 0 0 r/w r/w this bit sets the irq3 interrupt request edge detection mode. 00: interrupt request is detected on falling edge of irq3 input 01: interrupt request is detected on rising edge of irq3 input 10: interrupt request is detected on both of falling and rising edge of irq3 input 11: cannot be set 7 to 0 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
rev. 2.00, 09/04, page 79 of 720 6.3.3 irq status register (isr) isr is a 16-bit register that indicates the interrupt request status of the external interrupt input pins irq0 to irq3. when irq interrupts are set to edge detection, held interrupt requests can be withdrawn by writing 0 to irqnf after reading irqnf = 1. bit bit name initial value r/w description 15 to 8 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 7 6 5 4 irq0f irq1f irq2f irq3f 0 0 0 0 r/w r/w r/w r/w irq0 to irq3 flags these bits display the irq0 to irq3 interrupt request status. [setting condition] ? when interrupt source that is selected by icr1 and icr2 has occurred. [clearing conditions] ? when 0 is written after reading irqnf = 1 ? when interrupt exception processing has been executed at high level of irqn input under the low level detection mode. ? when irqn interrupt exception processing has been executed under the edge detection mode of falling edge, rising edge or both of falling and rising edge. ? when the disel bit of dtmr of dtc is 0, after dtc has been started by irqn interrupt. 3 to 0 ? all 0 r/w reserved these bits are always read as 0. the write value should always be 0.
rev. 2.00, 09/04, page 80 of 720 6.3.4 interrupt priority re gisters a, d to i, k (ipra, iprd to ipri, iprk) interrupt priority registers are nine 16-bit readable /writable registers that set priority levels from 0 to 15 for interrupts except nmi. for the corr espondence between interr upt request sources and ipr, refer to table 6.2 interrupt request sources, vector address, and interrupt priority level. each of the corresponding interrupt priority rank s are established by setting a value from h'0 to h'f in each of the four-bit groups 15 to 12, 11 to 8, 7 to 4 and 3 to 0. reserved bits that are not assigned should be set h'0 (b'0000.) bit bit name initial value r/w description 15 14 13 12 ipr15 ipr14 ipr13 ipr12 0 0 0 0 r/w r/w r/w r/w these bits set priority levels for the corresponding interrupt source. 0000: priority level 0 (lowest) 0001: priority level 1 0010: priority level 2 0011: priority level 3 0100: priority level 4 0101: priority level 5 0110: priority level 6 0111: priority level 7 1000: priority level 8 1001: priority level 9 1010: priority level 10 1011: priority level 11 1100: priority level 12 1101: priority level 13 1110: priority level 14 1111: priority level 15 (highest) 11 10 9 8 ipr11 ipr10 ipr9 ipr8 0 0 0 0 r/w r/w r/w r/w these bits set priority levels for the corresponding interrupt source. 0000: priority level 0 (lowest) 0001: priority level 1 0010: priority level 2 0011: priority level 3 0100: priority level 4 0101: priority level 5 0110: priority level 6 0111: priority level 7 1000: priority level 8 1001: priority level 9 1010: priority level 10 1011: priority level 11 1100: priority level 12 1101: priority level 13 1110: priority level 14 1111: priority level 15 (highest)
rev. 2.00, 09/04, page 81 of 720 bit bit name initial value r/w description 7 6 5 4 ipr7 ipr6 ipr5 ipr4 0 0 0 0 r/w r/w r/w r/w these bits set priority levels for the corresponding interrupt source. 0000: priority level 0 (lowest) 0001: priority level 1 0010: priority level 2 0011: priority level 3 0100: priority level 4 0101: priority level 5 0110: priority level 6 0111: priority level 7 1000: priority level 8 1001: priority level 9 1010: priority level 10 1011: priority level 11 1100: priority level 12 1101: priority level 13 1110: priority level 14 1111: priority level 15 (highest) 3 2 1 0 ipr3 ipr2 ipr1 ipr0 0 0 0 0 r/w r/w r/w r/w these bits set priority levels for the corresponding interrupt source. 0000: priority level 0 (lowest) 0001: priority level 1 0010: priority level 2 0011: priority level 3 0100: priority level 4 0101: priority level 5 0110: priority level 6 0111: priority level 7 1000: priority level 8 1001: priority level 9 1010: priority level 10 1011: priority level 11 1100: priority level 12 1101: priority level 13 1110: priority level 14 1111: priority level 15 (highest) note: name in the tables above is represented by a general name. name in the list of register is, on the other hand, represent ed by a module name.
rev. 2.00, 09/04, page 82 of 720 6.4 interrupt sources 6.4.1 external interrupts there are five types of interrupt sources: nmi, us er breaks, h-udi, irq, and on-chip peripheral modules. each interrupt has a priority expressed as a priority level (0 to 16, with 0 the lowest and 16 the highest). giving an interrupt a priority level of 0 masks it. nmi interrupts: the nmi interrupt has priority 16 and is always accepted. input at the nmi pin is detected by edge. use the nmi edge select bit (nmie) in the interrupt control register 1 (icr1) to select either the rising or falling edge. nmi interrupt exception processing sets the interrupt mask level bits (i3 to i0) in the status register (sr) to level 15. irq3 to irq0 interrupts: irq interrupts are requested by input from pins irq0 to irq3 . set the irq sense select bits (irq0s to irq3s) of the interrupt control re gister 1 (icr1) and irq edge select bit (irq0es[1:0] to irq3es[1:0]) of th e interrupt control register 2 (icr2) to select low level detection, falling edge detection, or rising edge detection for each pin. the priority level can be set from 0 to 15 for each pin using the interrupt priority registers a (ipra). when irq interrupts are set to low level detection, an interrupt request signal is sent to the intc during the period the irq pin is low level. interr upt request signals are not sent to the intc when the irq pin becomes high level. interrupt request levels can be confirmed by reading the irq flags (irq0f to irq3f) of th e irq status register (isr). when irq interrupts are set to falling edge detection, interrupt request signals are sent to the intc upon detecting a change on the irq pin from high to low level. the results of detection for irq interrupt request are maintained until the in terrupt request is accepted. it is possible to confirm that irq interrupt requests have been detected by reading the irq flags (irq0f to irq3f) of the irq status register (isr), and by writing a 0 after reading a 1, irq interrupt request detection results can be withdrawn. in irq interrupt exception processing, the interrupt ma sk bits (i3 to i0) of the status register (sr) are set to the priority level value of the accepted irq interr upt. figure 6.2 shows the block diagram of this irq3 to irq0 interrupts.
rev. 2.00, 09/04, page 83 of 720 irqns irqnes isr.irqnf irq pins resirqn level detection edge detection sq r selection determination cpu interrupt request dtc dtc starting request (acceptance of irqn interrupt/dtc transfer end/ writing 0 after reading irqnf = 1) figure 6.2 block diagram of irq3 to irq0 interrupts control 6.4.2 on-chip peripheral module interrupts on-chip peripheral module interrupts are interrupts generated by the following on-chip peripheral modules. as a different interrupt vector is assigned to each interrupt source, the exception service routine does not have to decide which interrupt has occurred. priority levels between 0 and 15 can be assigned to individual on-chip peripheral modules in interrupt priority registers a, d to i, k (ipra, iprd to ipri, iprk). on-chip peripheral module interrupt exception processing sets the interrupt mask level bits (i3 to i0) in the status re gister (sr) to the priority level value of the on- chip peripheral module in terrupt that was accepted. 6.4.3 user break interrupt a user break interrupt has a priority of level 15, and occurs when the break condition set in the user break controller (ubc) is satisfied. user break interrupt requests are detected by edge and are held until accepted. user br eak interrupt exception processing sets the interrupt mask level bits (i3 to i0) in the status register (sr) to level 15. for more details about the user break interrupt, see section 7, user break controller (ubc). 6.4.4 h-udi interrupt high-performance user debugging interface (h-udi) interrupt has a priority level of 15, and occurs when an h-udi interrupt instruction is serially input. h-udi interrupt requests are detected by edge and are held until accepted. h-udi exception processing sets the interrupt mask level bits (i3-i0) in the status register (sr) to level 15 . for more details about the h-udi interrupt, see section 22, high-performance user debug interface (h-udi).
rev. 2.00, 09/04, page 84 of 720 6.5 interrupt exception processing vectors table table 6.2 lists interrupt sources and their vector numbers, vector table address offsets and interrupt priorities. each interrupt source is allocated a different vector number and vect or table address offset. vector table addresses are calculated from the vector nu mbers and address offsets. in interrupt exception processing, the exception service ro utine start address is fetched from the vector table indicated by the vector table address. for the details of calculation of vector table address, see table 5.4, calculating exception processing vector table addresses in the section 5 exception processing. irq interrupts and on-chip periph eral module interrupt priorities can be set freely between 0 and 15 for each pin or module by setting interrupt prior ity registers a, d to i, k (ipra, iprd to ipri, iprk). however, the smaller vector number has interrupt source, the higher priority ranking is assigned among two or more interrupt sources specified by the same ipr, and the priority ranking cannot be changed. a power-on reset assigns priority level 0 to irq interrupts and on-chip peripheral module interrupts. if the same priority level is assigned to two or more interrupt sources and interrupts from those sources occur simultaneously, they are processed by the default priority order indicated in table 6.2.
rev. 2.00, 09/04, page 85 of 720 table 6.2 interrupt exception pro cessing vectors and priorities interrupt source name vector no. vector table starting address ipr default priority external pin nmi 11 h'0000002c ? high user break 12 h'00000030 ? h-udi 14 h'00000038 ? ? reserved by system 15 h'0000003c ? irq0 64 h'00000100 ipra15 to ipra12 irq1 65 h'00000104 ipra11 to ipra8 irq2 66 h'00000108 ipra7 to ipra4 irq3 67 h'0000010c ipra3 to ipra0 reserved by system 68 h'00000110 ? reserved by system 69 h'00000114 ? reserved by system 70 h'00000118 ? interrupts reserved by system 71 h'0000011c ? reserved by system 72 h'00000120 ? reserved by system 76 h'00000130 ? reserved by system 80 h'00000140 ? ? reserved by system 84 h'00000150 ? tgia_0 88 h'00000160 iprd15 to iprd12 tgib_0 89 h'00000164 tgic_0 90 h'00000168 tgid_0 91 h'0000016c mtu channel 0 tciv_0 92 h'00000170 iprd11 to iprd8 tgia_1 96 h'00000180 iprd7 to iprd4 tgib_1 97 h'00000184 tciv_1 100 h'00000190 iprd3 to iprd0 mtu channel 1 tciu_1 101 h'00000194 mtu channel 2 tgia_2 104 h'000001a0 ipre15 to ipre12 tgib_2 105 h'000001a4 tciv_2 108 h'000001b0 ipre11 to ipre8 tciu_2 109 h'000001b4 low
rev. 2.00, 09/04, page 86 of 720 interrupt source name vector no. vector table starting address ipr default priority mtu channel 3 tgia_3 112 h'000001c0 ipre7 to ipre4 high tgib_3 113 h'000001c4 tgic_3 114 h'000001c8 tgid_3 115 h'000001cc tciv_3 116 h'000001d0 ipre3 to ipre0 mtu channel 4 tgia_4 120 h' 000001e0 iprf15 to iprf12 tgib_4 121 h'000001e4 tgic_4 122 h'000001e8 tgid_4 123 h'000001ec tciv_4 124 h'000001f0 iprf11 to iprf8 ? reserved by system 128 to 135 h'00000200 to h'0000021c ? a/d adi0 136 h'00000220 iprg15 to iprg12 adi1 137 h'00000224 dtc swdtend 140 h'000002 30 iprg11 to iprg8 cmt cmi0 144 h'00000240 iprg7 to iprg4 cmi1 148 h'00000250 iprg3 to iprg0 watchdog timer iti 152 h'00000260 iprh15 to iprh12 ? reserved by system 153 h'00000264 ? i/o (mtu) mtupoe 156 h'00000270 iprh11 to iprh8 ? reserved by system 160 to 167 h'00000290 to h'0000029c ? sci channel 2 eri_2 168 h'000002a0 ipri15 to ipri12 rxi_2 169 h'000002a4 txi_2 170 h'000002a8 tei_2 171 h'000002ac sci channel 3 eri_3 172 h'000002b0 ipri11 to ipri8 rxi_3 173 h'000002b4 txi_3 174 h'000002b8 tei_3 175 h'000002bc low
rev. 2.00, 09/04, page 87 of 720 interrupt source name vector no. vector table starting address ipr default priority sci channel 4 eri_4 176 h'000002c0 ipri7 to ipri4 high rxi_4 177 h'000002c4 txi_4 178 h'000002c8 tei_4 179 h'000002cc mmt tgim 180 h'000002d0 ipri3 to ipri0 tgin 181 h'000002d4 ? reserved by system 184 h'000002e0 ? ? reserved by system 188 to 196 h'000002f0 to h'00000310 ? i/o(mmt) mmtpoe 200 h'00000320 iprk15 to iprk12 ? reserved by system 204 h'00000330 ? hcan2 ers1 208 h'00000340 iprk7 to iprk4 ovr1 209 h'00000344 rm1 210 h'00000348 sle1 211 h'0000034c ? reserved by system 212 h'00000350 to h'000003dc low
rev. 2.00, 09/04, page 88 of 720 6.6 interrupt operation 6.6.1 interrupt sequence the sequence of interrupt operations is explained below. figure 6.3 is a flowchart of the operations. 1. the interrupt request sources send interrupt request signals to the interrupt controller. 2. the interrupt controller selects the highest priority interrupt in the interrupt requests sent, according to the priority levels set in interrupt priority level setting registers a, d to i, k (ipra, iprd to ipri, iprk). interrupts that have lower-priority than that of the selected interrupt are ignored.* if interrupts that have the same priority level or interrupts within a same module occur simultaneously, the interrupt with th e highest priority is se lected according to the default priority order indicated in table 6.2. 3. the interrupt controller compares the priority level of the selected interrupt request with the interrupt mask bits (i3 to i0) in the cpu?s status register (sr). if the request priority level is equal to or less than the level set in i3 to i0, th e request is ignored. if the request priority level is higher than the level in bits i3 to i0, th e interrupt controller accept s the interrupt and sends an interrupt request signal to the cpu. 4. when the interrupt contro ller accepts an interrupt, a lo w level is output from the irqout pin. 5. the cpu detects the interrupt request sent fro m the interrupt controller when cpu decodes the instruction to be executed. in stead of executing the decoded instruction, th e cpu starts interrupt exception processing (figure 6.5). 6. sr and pc are saved onto the stack. 7. the priority level of the accepted interrupt is copi ed to the interrupt mask level bits (i3 to i0) in the status register (sr). 8. when the accepted interrupt is sensed by level or is from an on-chip peripheral module, a high level is output from the irqout pin. when the accepted interrupt is sensed by edge, a high level is output from the irqout pin at the moment when the cpu starts interrupt exception processing instead of instruction execution as noted in (5) above. however, if the interrupt controller accepts an interrupt with a higher prior ity than the interrupt ju st to be accepting, the irqout pin holds low level. 9. the cpu reads the start address of the excep tion service routine from the exception vector table for the accepted interrupt, jumps to that ad dress, and starts executing the program. this jump is not a delay branch. note: * interrupt requests that are designated as edge-detect type are held pending until the interrupt requests are accepted. irq interrupt s, however, can be cancelled by accessing the irq status register (isr). interrupts held pending due to edge detection are cleared by a power-on reset or a manual reset.
rev. 2.00, 09/04, page 89 of 720 program execution state interrupt? nmi? user break? i3 to i0 level 14? level 14 interrupt? level 1 interrupt? i3 to i0 level 13? i3 to i0 = level 0? no yes no no no no no no no no yes yes yes yes yes yes yes yes irqout = low * 1 save sr to stack save pc to stack copy accept-interrupt level to i3 to i0 irqout = high read exception vector table branch to exception service routine * 2 h-udi interrupt? no yes level 15 interrupt? notes: i3 to i0 are interrupt mask bits of status register (sr) in the cpu * 1 irqout is the same signal as interrupt request signal to the cpu (see figure 6.1). therefore, irqout is output when the request priority level is higher than the level in bits i3?i0 of sr. * 2 when the accepted interrupt is sensed by edge, a high level is output from the irqout pin at the moment when the cpu starts interrupt exception processing instead of instruction execution (namely, before saving sr to stack). however, if the interrupt controller accepts an interrupt with a higher priority than the interrupt just to be accepted and has output an interrupt request to the cpu, the irqout pin holds low level. figure 6.3 interrupt sequence flowchart
rev. 2.00, 09/04, page 90 of 720 6.6.2 stack after interrupt exception processing figure 6.4 shows the stack afte r interrupt exception processing. 32 bits 32 bits pc * 1 sr address 4n?8 4n?4 4n sp * 2 notes: * 1 pc: start address of the next instruction (return destination instruction) after the executing instruction * 2 always make sure that sp is a multiple of 4 figure 6.4 stack after inte rrupt exception processing
rev. 2.00, 09/04, page 91 of 720 6.7 interrupt response time table 6.3 lists the interrupt response time, which is the time from the occurrence of an interrupt request until the interrupt exception processing starts and fetching of the first instruction of the interrupt service routine begins. figure 6.5 shows an example of the pipeline operation when an irq interrupt is accepted. table 6.3 interrupt response time number of states item nmi, peripheral module irq remarks dtc active judgment 0 or 1 1 1 state required for interrupt signals for which dtc activation is possible interrupt priority judgment and comparison with sr mask bits 2 3 wait for completion of sequence currently being executed by cpu x ( 0) x ( 0) the longest sequence is for interrupt or address-error exception processing (x = 4 + m1 + m2 + m3 + m4). if an interrupt-masking instruction follows, however, the time may be even longer. time from start of interrupt exception processing until fetch of first instruction of exception service routine starts 5 + m1 + m2 + m3 5 + m1 + m2 + m3 performs the saving pc and sr, and vector address fetch. total: (7 or 8) + m1 + m2 + m3+x 9 + m1 + m2 + m3 + x minimum: 10 12 0.25 0.3 s at 40 mhz interrupt response time maximum: 12 + 2 (m1 + m2 + m3) + m4 13 + 2 (m1 + m2 + m3) + m4 0.48 s at 40 mhz * note: * 0.48 s at 40 mhz is the value in the case that m1 = m2 = m3 = m4 = 1. m1 to m4 are the number of states needed for the following memory accesses. m1: sr save (longword write) m2: pc save (longword write) m3: vector address read (longword read) m4: fetch first instruction of interrupt service routine
rev. 2.00, 09/04, page 92 of 720 fde mee mme ee fd f 3 1 3 interrupt acceptance irq m1 m2 1 m3 1 5 + m1 + m2 + m3 instruction (instruction replaced by interrupt exception processing) overrun fetch interrupt service routine start instruction f: instruction fetch (instruction fetched from memory where program is stored). d: instruction decoding (fetched instruction is decoded). e: instruction execution (data operation and address calculation is performed according to the results of decoding). m: memory access (data in memory is accessed). figure 6.5 example of the pipeline oper ation when an irq interrupt is accepted
rev. 2.00, 09/04, page 93 of 720 6.8 data transfer with interrupt request signals the following data transfers can be done using interrupt request signals: ? activate dtc only, cpu interrupts according to dtc settings the intc masks cpu interrupts when the corresp onding dte bit is 1. the conditions for clearing dte and interrupt source flag are listed below. dte clear condition = dtc transfer end ? dteclr interrupt source flag clear condition = dtc transfer end ? dteclr where: dteclr = disel + counter 0. figure 6.6 shows a control block diagram. interrupt source flag clear (by dtc) cpu interrupt request dtc activation request dteclr transfer end dter dte clear interrupt source figure 6.6 interrupt control block diagram 6.8.1 handling interrupt reque st signals as sources fo r dtc activating and cpu interrupt 1. for dtc, set the corresponding dte bits and disel bits to 1. 2. activating sources are applied to the dtc when interrupts occur. 3. when the dtc performs a data transfer, it clears the dte bit to 0 and sends an interrupt request to the cpu. the activ ating source is not cleared. 4. the cpu clears interrupt sources in the interrupt processing rou tine then confirms the transfer counter value. when the transfer counter value is not 0, the cpu sets the dte bit to 1 and allows the next data transfer. if the transfer counter value = 0, the cpu performs the necessary end processing in the interrupt processing routine.
rev. 2.00, 09/04, page 94 of 720 6.8.2 handling interrupt reque st signals as source for dt c activating, but not cpu interrupt 1. for dtc, set the corresponding dte bits to 1 and clear the disel bits to 0. 2. activating sources are applied to the dtc when interrupts occur. 3. when the dtc performs a data transfer, it clear s the activating source. an interrupt request is not sent to the cpu, because the dte bit is hold to 1. 4. however, when the transfer counter value = 0 the dte bit is cleared to 0 and an interrupt request is sent to the cpu. 5. the cpu performs the necessa ry end processing in the in terrupt processing routine. 6.8.3 handling interrupt reque st signals as source for cpu interrupt but not dtc activating 1. for dtc, clear the corr esponding dte bits to 0. 2. when interrupts occur, interrupt requests are sent to the cpu. 3. the cpu clears the interrupt source and perfor ms the necessary proce ssing in the interrupt processing routine.
rev. 2.00, 09/04, page 95 of 720 section 7 user break controller (ubc) the user break controller (ubc) provides functions that make program debugging easier. by setting break conditions in the ubc, a user break in terrupt is generated according to the contents of the bus cycle generated by the cpu or dtc. this function makes it easy to design an effective self-monitoring debugger, and customers of the chip can easily debug their programs without using a large in-circuit emulator. 7.1 overview ? there are 5 types of break co mpare conditions as follows: ? address ? cpu cycle or dtc cycle ? instruction fetch or data access ? read or write ? operand size: longword/word/byte ? user break interrupt generated upon satisfying break conditions ? user break interrupt generated before an instruction is executed by selecting break in the cpu instruction fetch. ? satisfaction of a break condition can be output to the ubctrg pin. ? module standby mode can be set
rev. 2.00, 09/04, page 96 of 720 figure 7.1 shows a block diagram of the ubc. module bus ubbr ubamrh ubamrl ubarh ubarl break condition comparator user break interrupt generating circuit bus interface internal bus interrupt request interrupt controller ubarh, ubarl: user break address registers h, l ubamrh, ubamrl: user break address mask registers h, l ubbr: user break bus cycle register ubcr: user break control register trigger output generating circuit ubcr ubctrg pin output ubc figure 7.1 user break controller block diagram
rev. 2.00, 09/04, page 97 of 720 7.2 register descriptions the ubc has the following registers. for details on register addresses and register states during each processing, refer to appendix a, internal i/o register. ? user break address register h (ubarh) ? user break address register l (ubarl) ? user break address mask register h (ubamrh) ? user break address mask register l (ubamrl) ? user break bus cycle register (ubbr) ? user break control register (ubcr) 7.2.1 user break address register (ubar) the user break address register (ubar) consists of two registers: user break address register h (ubarh) and user break address register l (ubarl ). both are 16-bit readable/writable registers. ubarh specifies the upper bits (bits 31 to 16 ) of the address for th e break condition, while ubarl specifies the lower bits (bits 15 to 0). the initial value of ubar is h'00000000. ? ubarh bits 15 to 0: specifies user break address 31 to 16 (uba31 to uba16) ? ubarl bits 15 to 0: specifies user break address 15 to 0 (uba15 to uba0)
rev. 2.00, 09/04, page 98 of 720 7.2.2 user break address mask register (ubamr) the user break address mask register (ubamr) consists of two registers: user break address mask register h (ubamrh) and user break address mask register l (ubamrl). both are 16-bit readable/writable registers. ubam rh specifies whether to mask any of the break address bits set in ubarh, and ubamrl specifies whether to mask any of the break address bits set in ubarl. ? ubamrh bits 15 to 0: specifies user break address mask 31 to 16 (ubm31 to ubm16) ? ubamrl bits 15 to 0: specifies user br eak address mask 15 to 0 (ubm15 to ubm0) bit bit name initial value r/w description ubamrh15 to ubamrh 0 ubm31 to ubm16 all 0 r/w user break address mask 31 to 16 0: corresponding uba bit is included in the break conditions 1: corresponding uba bit is not included in the break conditions ubamrl15 to ubamrl0 ubm15 to ubm0 all 0 r/w user break address mask 15 to 0 0: corresponding uba bit is included in the break conditions 1: corresponding uba bit is not included in the break conditions 7.2.3 user break bus cycle register (ubbr) the user break bus cycle register (ubbr) is a 16-b it readable/writable register that sets the four break conditions. bit bit name initial value r/w description 15 to 8 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 7 6 cp1 cp0 0 0 r/w r/w cpu cycle/dtc cycle select 1 and 0 these bits specify break conditions for cpu cycles or dtc cycles. 00: no user break interrupt occurs 01: break on cpu cycles 10: break on dtc cycles 11: break on both cpu and dtc cycles
rev. 2.00, 09/04, page 99 of 720 bit bit name initial value r/w description 5 4 id1 id0 0 0 r/w r/w instruction fetch/data access select1 and 0 these bits select whether to break on instruction fetch and/or data access cycles. 00: no user break interrupt occurs 01: break on instruction fetch cycles 10: break on data access cycles 11: break on both instruction fetch and data access cycles 3 2 rw1 rw0 0 0 r/w r/w read/write select 1 and 0 these bits select whether to break on read and/or write cycles 00: no user break interrupt occurs 01: break on read cycles 10: break on write cycles 11: break on both read and write cycles 1 0 sz1 sz0 0 0 r/w r/w operand size select 1 and 0 * these bits select operand size as a break condition. 00: operand size is not a break condition 01: break on byte access 10: break on word access 11: break on longword access note: * when breaking on an instruction fetch, clear the sz0 bit to 0. all instructions are considered to be accessed in word-size (eve n when there are instructions in on-chip memory and two instruction fetches are pe rformed simultaneously in one bus cycle). operand size is word for instructions or determined by the operand size specified for the cpu/dtc data access. it is not determin ed by the bus width of the space being accessed.
rev. 2.00, 09/04, page 100 of 720 7.2.4 user break control register (ubcr) the user break control register (ubcr) is a 16-bit readable/writable register that (1) enables or disables user break interrupts an d (2) sets the pulse width of the ubctrg signal output in the event of a break condition match. bit bit name initial value r/w description 15 to 3 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 2 1 cks1 cks0 0 0 r/w r/w clock select 1 and 0 these bits specify the pulse width of the ubctrg signal output in the event of a condition match. 00: ubctrg pulse width is 01: ubctrg pulse width is /4 10: ubctrg pulse width is /8 11: ubctrg pulse width is /16 note: means internal clock 0 ubid 0 r/w user break disable enables or disables user break interrupt request generation in the event of a user break condition match. 0: user break interrupt request is enabled 1: user break interrupt request is disabled
rev. 2.00, 09/04, page 101 of 720 7.3 operation 7.3.1 flow of the user break operation the flow from setting of break conditions to user break interrupt exception processing is described below: 1. the user break addresses are set in the user break address register (ubar), the desired masked bits in the addresses are set in the user brea k address mask register (ubamr) and the breaking bus cycle type is set in the user break bus cy cle register (ubbr). if even one of the three groups of the ubbr?s cpu cycle/dtc cycle sel ect bits (cp1, cp0), instruction fetch/data access select bits (id1, id0), and read/write select bits (rw1, rw0) is se t to 00 (no user break generated), no user break interrupt will be genera ted even if all other conditions are satisfied. when using user break interrupts, always be certain to establish bit conditions for all of these three groups. 2. the ubc uses the method shown in figure 7.2 to determine whether set conditions have been satisfied or not. when the set conditions are satisfied, the ubc sends a user break interrupt request signal to the interrupt controller (intc). at the same time, a condition match signal is output at the ubctrg pin with the pulse width set in bits cks1 and cks0. 3. the interrupt controller checks the accepted user break interrupt request signal?s priority level. the user break interrupt has prio rity level 15, so it is accepted only if the interrupt mask level in bits i3?i0 in the status regist er (sr) is 14 or lower. when the i3?i0 bit level is 15, the user break interrupt cannot be accepted but it is held pending until user break interrupt exception processing can be carried out. consequently, user break interrupts within nmi exception service routines cannot be accepted, since the i3?i0 bit level is 15. however, if the i3?i0 bit level is changed to 14 or lower at the start of the nmi exception service routine, user break interrupts become acceptable ther eafter. see section 6, interr upt controller (intc), for the details on the handling of priority levels. 4. the intc sends the user break interrupt request signal to the cpu, which begins user break interrupt exception processing up on receipt. see section 6.6, inte rrupt operation, for the details on interrupt exception processing.
rev. 2.00, 09/04, page 102 of 720 ubarh/ubarl ubamrh/ubamrl internal address bits 31?0 cpu cycle dtc cycle instruction fetch data access read cycle write cycle byte size word size longword size 32 32 32 32 32 cp1 cp0 id1 id0 rw1 rw0 sz1 sz0 user break interrupt ubid figure 7.2 break condition determination method
rev. 2.00, 09/04, page 103 of 720 7.3.2 break on on-chip memo ry instruction fetch cycle data in on-chip memory (on-chip rom and/or ra m) is always accessed as 32-bits data in one bus cycle. therefore, two instructions can be retr ieved in one bus cycle when fetching instructions from on-chip memory. at such times, only one bus cycle is generated, but it is possible to cause independent breaks by setting the start addresses of both instructions in the user break address register (ubar). in other words, when wanting to effect a break using the latter of two addresses retrieved in one bus cycle, set the start address of that instruction in ub ar. the break will occur after execution of the former instruction. 7.3.3 program counter (pc) values saved break on instruction fetch: the program counter (pc) value sa ved to the stack in user break interrupt exception processing is the address th at matches the break condition. the user break interrupt is generated before the fetched instructio n is executed. if a break condition is set in an instruction fetch cycle placed immedi ately after a delayed branch instru ction (delay slot), or on an instruction that follows an interrupt-disabled instruction, however, the user break interrupt is not accepted immediately, but the break condition establishing instructio n is executed. the user break interrupt is accepted after execution of the instruc tion that has accepted the in terrupt. in this case, the pc value saved is the start address of the inst ruction that will be executed after the instruction that has accepted the interrupt. break on data access (cpu/dtc): the program counter (pc) value is the top address of the next instruction after the last instruction executed before the user break exception processing started. when data access (cpu/dtc) is set as a break condition, the pl ace where the break will occur cannot be specified exactly. the break will occur at the instruction fetched close to where the data access that is to receive the break occurs.
rev. 2.00, 09/04, page 104 of 720 7.4 examples of use break on cpu instruction fetch cycle 1. register settings: ubarh = h'0000 ubarl = h'0404 ubbr = h'0054 ubcr = h'0000 conditions set: address: h'00000404 bus cycle: cpu, inst ruction fetch, read (operand size is not included in conditions) interrupt requests enabled a user break interrupt will occur before the instruction at address h'00000404. if it is possible for the instruction at h'00000402 to accept an interrupt, the user break exception processing will be executed after execution of that instru ction. the instruction at h'00000404 is not executed. the pc value saved is h'00000404. 2. register settings: ubarh = h'0015 ubarl = h'389c ubbr = h'0058 ubcr = h'0000 conditions set: address: h'0015389c bus cycle: cpu, instruction fetch, write (operand size is not included in conditions) interrupt requests enabled a user break interrupt does not occur because the instruction fetch cycle is not a write cycle. 3. register settings: ubarh = h'0003 ubarl = h'0147 ubbr = h'0054 ubcr = h'0000 conditions set: address: h'00030147 bus cycle: cpu, inst ruction fetch, read (operand size is not included in conditions) interrupt requests enabled a user break interrupt does not occur because the instruction fetch was performed for an even address. however, if the first instruction fetch ad dress after the branch is an odd address set by these conditions, user break interrupt exception processing will be carried out after address error excepti on processing.
rev. 2.00, 09/04, page 105 of 720 break on cpu data access cycle 1. register settings: ubarh = h'0012 ubarl = h'3456 ubbr = h'006a ubcr = h'0000 conditions set: address: h'00123456 bus cycle: cpu, data access, write, word interrupt requests enabled a user break interrupt occurs when word data is written into address h'00123456. 2. register settings: ubarh = h'00a8 ubarl = h'0391 ubbr = h'0066 ubcr = h'0000 conditions set: address: h'00a80391 bus cycle: cpu, data access, read, word interrupt requests enabled a user break interrupt does not occur because the word access was performed on an even address. break on dtc cycle 1. register settings: ubarh = h'0076 ubarl = h'bcdc ubbr = h'00a7 ubcr = h'0000 conditions set: address: h'0076bcdc bus cycle: dtc, data access, read, longword interrupt requests enabled a user break interrupt occurs when longword data is read from address h'0076bcdc. 2. register settings: ubarh = h'0023 ubarl = h'45c8 ubbr = h'0094 ubcr = h'0000 conditions set: address: h'002345c8 bus cycle: dtc, instruction fetch, read (operand size is not included in conditions) interrupt requests enabled a user break interrupt does not occur because no instruction fetch is performed in the dtc cycle.
rev. 2.00, 09/04, page 106 of 720 7.5 usage notes 7.5.1 simultaneous fetching of two instructions two instructions may be simultaneously fetched in instruction fetch operation. once a break condition is set on the latter of these two instructions, a user break interrupt will occur before the latter instruction, even though the contents of th e ubc registers are modifi ed to change the break conditions immediately after the fetching of the former instruction. 7.5.2 instruction fetches at branches when a conditional branch instruction or trapa instruction causes a branch, the order of instruction fetching and execution is as follows: 1. when branching with a conditional branch instruction: bt and bf instructions when branching with a trapa instruction: trapa instruction a. instruction fetch order branch instruction fetch next instruction overrun fetch overrun fetch of instruction after the next branch destination instruction fetch b. instruction execution order branch instruction execution branch destination instruction execution 2. when branching with a delayed conditional branch instruction: bt/s and bf/s instructions a. instruction fetch order branch instruction fetch next instruction fetch (delay slot) overrun fetch of instruction after the next branch destination instruction fetch b. instruction execution order branch instruction execution delay slot instruction execution branch destination instruction execution thus, when a conditional branch instruction or trapa instruction causes a branch, the branch destination instruction will be fetched after an overrun fetch of the next instruction or the instruction after the next. however, as the instruct ion that is the object of the break does not break until fetching and execution of the instruction have been confirmed, the overrun fetches described above do not become objects of a break. if data accesses are also included in break conditions besides instruction fetc h, a break will occur because the instruction overrun fe tch is also regarded as satisfying the data break condition.
rev. 2.00, 09/04, page 107 of 720 7.5.3 contention between user break and exception processing if a user break is set for the fetch of a particular instruction, and exception processing with higher priority than a user break is in contention and is accepted in the decode st age for that instruction (or the next instruction), user break exception processing may not be performed after completion of the higher-priority exception service routine (on return by rte). thus, if a user break condition is specified to the branch destination instruction fetch after a branch (bra, braf, bt, bf, bt/s, bf/s, bsr, bsrf, jmp, jsr, rts, rte, exception processing), and that branch instruction accepts an exception processing with higher priority than a user break interrupt, user break exception processing is not performed after completion of the exception service routine. therefore, a user break condition should not be set for the fetch of the branch destination instruction after a branch. 7.5.4 break at non-delay branch instruction jump destination when a branch instruction without delay slot (including exception processing) jumps to the destination instruction by executing the branch, a user break will not be generated even if a user break condition has been set for the first jump destination instruction fetch. 7.5.5 user break trigger output information on internal bus condition matches monitored by the ubc is output as ubctrg . the trigger width can be set with clock select bits 1 and 0 (cks1, cks0) in the user break control register (ubcr). if a condition match occurs again during trigger output, the ubctrg pin continues to output a low level, and outputs a pulse of the length set in bits cks1 and cks0 from the cycle in which the last condition match occurs. the trigger output conditions differ from those in the case of a user break interrupt when a cpu instruction fetch condition is satisfied. when a condition match occurs in an overrun fetch instruction as described in section 7.5.2, instruction fetch at branches, a user break interrupt is not requested but a trigger is output from the ubctrg pin. in other cpu data accesses and dtc bus cycles, pu lse is output under the conditions similar to user break interrupt conditions. setting the user break interrupt disable (ubid) bi t to 1 in ubcr enables trigger output to be monitored externally without re questing a user break interrupt.
rev. 2.00, 09/04, page 108 of 720 7.5.6 module standby mode setting the ubc can set the module disable/enable by using the module standby control register 2 (mstcr2). by releasing the module standby mo de, register access becomes to be enabled. by setting the mstp0 bit of mstcr2 to 1, the ubc is in the module standby mode in which the clock supply is halted. see section 24, power-down modes, for further details.
rev. 2.00, 09/04, page 109 of 720 section 8 data transfer controller (dtc) this lsi includes a data transfer controller (dtc ). the dtc can be activated by an interrupt or software, to transfer data. figure 8.1 shows a block diagram of the dtc. the dtc?s register information is stored in the on-chip ram. when the dtc is used, the rame bit in syscr must be set to 1. 8.1 features ? transfer possible over any number of channels ? three transfer modes normal, repeat, and block transfer modes available ? one activation source can trigger a number of data transfer s (chain transfer) ? direct specification of 32 -bit address space possible ? activation by software is possible ? transfer can be set in byte, word, or longword units ? the interrupt that activated the dtc can be requested to the cpu ? module standby mode can be set
rev. 2.00, 09/04, page 110 of 720 on-chip rom on-chip ram external memory external device (memory- mapped) on-chip peripheral module cpu interrupt request source clear control register control dtmr dtcr dtsar dtdar dtiar dter dtcsr dtbr dtc dtc module bus activation control internal bus peripheral bus external bus request priority control interrupt request bus interface bus controller notes dtmr: dtc mode register dtcr: dtc transfer count register dtsar: dtc source address register dtdar: dtc destination address register dtiar: dtc initial address register dter: dtc enable register dtcsr: dtc control/status register dtbr: dtc information base register figure 8.1 block diagram of dtc
rev. 2.00, 09/04, page 111 of 720 8.2 register descriptions dtc has the following registers. ? dtc mode register (dtmr) ? dtc source address register (dtsar) ? dtc destination address register (dtdar) ? dtc initial address register (dtiar) ? dtc transfer count register a (dtcra) ? dtc transfer count register b (dtcrb) these six registers cannot be di rectly accessed from the cpu. when activated, the dtc transfer desired set of register information that is stored in an on-chip ram to the corresponding dtc registers. after the data transfer, it writes a set of updated register information back to the ram. ? dtc enable register a (dtea) ? dtc enable register b (dteb) ? dtc enable register c (dtec) ? dtc enable register d (dted) ? dtc enable register e (dtee) ? dtc enable register f (dtef) ? dtc control/status register (dtcsr) ? dtc information base register (dtbr) for details on register addresses and register states during each processing, refer to appendix a, internal i/o register.
rev. 2.00, 09/04, page 112 of 720 8.2.1 dtc mode register (dtmr) dtmr is a 16-bit register that selects the dtc operating mode. bit bit name initial value r/w description 15 14 sm1 sm0 undefined undefined ? ? source address mode 1 and 0 these bits specify a dtsar operation after a data transfer. 0x: dtsar is fixed 10: dtsar is incremented after a transfer (by +1 when sz 1 and 0 = 00; by +2 when sz 1 and 0 = 01; by +4 when sz 1 and 0 = 10) 11: dtsar is decremented after a transfer (by ?1 when sz 1 and 0 = 00; by ?2 when sz 1 and 0 = 01; by ?4 when sz 1 and 0 = 10) 13 12 dm1 dm0 undefined undefined ? ? destination address mode 1 and 0 these bits specify a dtdar operation after a data transfer. 0x: dtdar is fixed 10: dtdar is incremented after a transfer (by +1 when sz 1 and 0 = 00; by +2 when sz 1 and 0 = 01; by +4 when sz 1 and 0 = 10) 11: dtdar is decremented after a transfer (by ?1 when sz 1 and 0 = 00; by ?2 when sz 1 and 0 = 01; by ?4 when sz 1 and 0 = 10) 11 10 md1 md0 undefined undefined ? ? dtc mode 1 and 0 these bits specify the dtc transfer mode. 00: normal mode 01: repeat mode 10: block transfer mode 11: setting prohibited 9 8 sz1 sz0 undefined undefined ? ? dtc data transfer size 1 and 0 specify the size of data to be transferred. 00: byte-size transfer 01: word-size transfer 10: longword-size transfer 11: setting prohibited
rev. 2.00, 09/04, page 113 of 720 bit bit name initial value r/w description 7 dts undefined ? dtc transfer mode select specifies whether the source or the destination is set to be a repeat area or block area, in repeat mode or block transfer mode. 0: destination is repeat area or block area 1: source is repeat area or block area 6 chne undefined ? dtc chain transfer enable when this bit is set to 1, a chain transfer will be performed. 0: chain transfer is canceled 1: chain transfer is set in data transfer with chne set to 1, determination of the end of the specified num ber of transfers, clearing of the activation source flag, and clearing of dter is not performed. 5 disel undefined ? dtc interrupt select when this bit is set to 1, a cpu interrupt request is generated for every dtc transfer. when this bit is set to 0, a cpu interrupt request is generated at the time when the specified number of data transfer ends. 4 nmim undefined ? dtc nmi mode this bit designates whether to terminate transfers when an nmi is input during dtc transfers. 0: terminate dtc transfer upon an nmi 1: continue dtc transfer until end of transfer being executed 3 to 0 ? undefined ? reserved these bits have no effect on dtc operation and should always be written with 0. [legend] x: don?t care
rev. 2.00, 09/04, page 114 of 720 8.2.2 dtc source address register (dtsar) the dtc source address register (dtsar) is a 32-bit register th at specifies the dtc transfer source address. specify an even address in case the transfer size is word ; specify a multiple-of- four address in case of longword. the initial value is undefined. 8.2.3 dtc destination address register (dtdar) the dtc destination address register (dtdar) is a 32-bit register that sp ecifies the dtc transfer destination address. specify an even address in case the transfer size is word; specify a multiple- of-four address in case of longword. the initial value is undefined. 8.2.4 dtc initial address register (dtiar) the dtc initial address register (dtiar) is a 32-b it register that specifies the initial transfer source/transfer destination address in repeat mode. in repeat mode, when the dts bit is set to 1, specify the initial transfer source address in the repeat area, an d when the dts bit is cleared to 0, specify the initial transfer destin ation address in the repeat area. the initial value is undefined. 8.2.5 dtc transfer count register a (dtcra) dtcra is a 16-bit register that de signates the number of times data is to be transferred by the dtc. the initial value is undefined. in normal mode, the entire dtcra functions as a 16-bit transfer counter (1 to 65536). it is decremented by 1 every time data is transferred, and transfer ends when the count reaches h'0000. the number of transfers is 1 when the set value is h'0001, 65535 when it is h'ffff, and 65536 when it is h'0000. in repeat mode, dtcrah maintains the transf er count and dtcral fu nctions as an 8-bit transfer counter. the number of transfers is 1 when the set value is dtcrah = dtcral = h'01, 255 when they are h'ff, and 256 when it is h'00. in block transfer mode, it functions as a 16-bit tran sfer counter. the number of transfers is 1 when the set value is h'0001, 65 535 when it is h'ffff, and 65536 when it is h'0000. 8.2.6 dtc transfer count register b (dtcrb) the dtcrb is a 16-bit register that designates th e block length in block transfer mode. the block length is 1 when the set value is h'0001, 65535 when it is h'ffff , and 65536 when it is h'0000. the initial value is undefined.
rev. 2.00, 09/04, page 115 of 720 8.2.7 dtc enable registers (dter) dter which is comprised of seven registers, d tea to dtef, is a register that specifies dtc activation interrupt sources. the correspondence between interrupt sources and dte bits is shown in table 8.1. bit bit name initial value r/w description 7 6 5 4 3 2 1 0 dte * 7 dte * 6 dte * 5 dte * 4 dte * 3 dte * 2 dte * 1 dte * 0 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w dtc activation enable 7 to 0 setting this bit to 1 specifies the corresponding interrupt source to a dtc activation source. [clearing conditions] ? when the disel bit is 1 and the data transfer has ended ? when the specified number of transfers have ended ? 0 is written to the bit to be cleared after 1 has been read from the bit these bits are not cleared when the disel bit is 0 and the specified number of transfers have not ended. [setting condition] 1 is written to the bit to be set after a 0 has been read from the bit note: * the last character of the dtc enable register?s name comes here. example: dteb3 in dteb, etc.
rev. 2.00, 09/04, page 116 of 720 8.2.8 dtc control/status register (dtcsr) the dtcsr is a 16-bit readable/writable register th at disables/enables dtc activation by software and sets the dtc vector addresses for software activation. it also indicates the dtc transfer status. bit bit name initial value r/w description 15 to 11 ? all 0 r reserved these bits have no effect on dtc operation and should always be written with 0. 10 nmif 0 r/(w) * 1 nmi flag bit this bit indicates that an nmi interrupt has occurred. 0: no nmi interrupts [clearing condition] ? write 0 after reading the nmif bit 1: nmi interrupt has been generated when the nmif bit is set, dtc transfers are not allowed even if the dter bit is set to 1. if, however, a transfer has already started with the nmim bit of the dtmr set to 1, executio n will continue until that transfer ends. 9 ae 0 r/(w) * 1 address error flag this bit indicates that an address error by the dtc has occurred. 0: no address error by the dtc [clearing condition] ? write 0 after reading the ae bit 1: an address error by the dtc occurred when the ae bit is set, dtc transfers are not allowed even if the dter bit is set to 1. 8 swdte 0 r/w * 2 dtc software activation enable setting this bit to 1 activates dtc. 0: dtc activation by software disabled 1: dtc activation by software enabled
rev. 2.00, 09/04, page 117 of 720 bit bit name initial value r/w description 7 6 5 4 3 2 1 0 dtvec7 dtvec6 dtvec5 dtvec4 dtvec3 dtvec2 dtvec1 dtvec0 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w dtc software activation vectors 7 to 0 these bits specify the lower eight bits of the vector addresses for dtc activation by software. a vector address is calculated as h'0400 + dtvec (7:0). always specify 0 for dtvec0. for example, when dtvec7 to dtvec0 = h' 10, the vector address is h'0410. when the bit swdt e is 0, these bits can be written to. notes: 1. for the nmif and ae bits, only a 0 write after a 1 read is possible. 2. for the swdte bit, a 1 write is always possi ble, but a 0 write is possible only after a 1 is read. 8.2.9 dtc information base register (dtbr) the dtbr is a 16-bit readable/writable register th at specifies the upper 16 bits of the memory address containing dtc transf er information. always access the dtbr in word or longword units. if it is accessed in byte units the register contents will become undefined at the time of a write, and undefined values will be read out upon reads. the initial value is undefined.
rev. 2.00, 09/04, page 118 of 720 8.3 operation 8.3.1 activation sources the dtc operates when activated by an interrupt or by a write to dtcsr by software. an interrupt request can be directed to the cpu or dtc, as designated by the corresponding dter bit. at the end of a data transfer (or the last consecutive transfer in the case of chain transfer), the activation source interrupt flag or corresponding d ter bit is cleared. the activation source flag, in the case of rxi_2, for exampl e, is the rdrf flag of sci2. when a dtc is activated by an interrupt, exis ting cpu mask level and interrupt controller priorities have no effect. if there is more than one activation source at the same time, the dtc operates in accordance with the default priorities. figure 8.2 shows a block diagram of activation source control. for details see section 6, interrupt controller (intc). irq on-chip peripheral interrupt requests cpu interrupt requests (those not designated as dtc activating sources) source flag clear dter intc dtc dtc control clear dtc activation request figure 8.2 activating so urce control block diagram 8.3.2 location of register information and dtc vector table figure 8.3 shows the allocation of register information in memory space. the register information start addresses are designated by dtbr for the upper 16 bits, and the dtc vector table for the lower 16 bits. the allocation in order from the register inform ation start address in normal mode is dtmr, dtcra, 4 bytes empty (no effect on dtc operation), dtsar, then dtdar. in repeat mode it is dtmr, dtcra, dtiar, dtsar, and dtdar. in block transfer mode, it is dtmr, dtcra, 2 bytes empty (no effect on dtc oper ation), dtcrb, dtsar, then dtdar. fundamentally, certain ram areas are designated for addresses storing register information.
rev. 2.00, 09/04, page 119 of 720 memory space normal mode dtmr dtcra dtsar dtdar memory space repeat mode dtmr dtcra dtsar dtdar memory space block transfer mode register information dtmr dtcra dtcrb dtiar dtsar dtdar register information start address figure 8.3 dtc register informat ion allocation in memory space figure 8.4 shows the correspondence between dt c vector addresses and register information allocation. for each dtc activatin g source there are 2 bytes in the dtc vector table, which contain the register info rmation start address. table 8.1 shows the correspondence between ac tivating sources and vector addresses. when activating with software, the vector addre ss is calculated as h'0400 + dtvec[7:0]. through dtc activation, a register information star t address is read from the vector table, then register information placed in memory space is read from that register information start address. always designate register information start addresses in multiples of four. dtbr dtc vector table dtc vector address transfer information start address (upper 16 bits) register information memory space register information start address (lower 16 bits) figure 8.4 correspondence between dtc vector address and transfer information
rev. 2.00, 09/04, page 120 of 720 table 8.1 interrupt sources , dtc vector addresses, and corresponding dtes activating source generator activating source dtc vector address dte bit transfer source transfer destination priority mtu (ch4) tgi4a h'00000400 dtea7 arbitrary * arbitrary * high tgi4b h'00000402 dtea6 arbitrary * arbitrary * tgi4c h'00000404 dtea5 arbitrary * arbitrary * tgi4d h'00000406 dtea4 arbitrary * arbitrary * tgi4v h'00000408 dtea3 arbitrary * arbitrary * mtu (ch3) tgi3a h'0000040a dtea2 arbitrary * arbitrary * tgi3b h'0000040c dtea1 arbitrary * arbitrary * tgi3c h'0000040e dtea0 arbitrary * arbitrary * tgi3d h'00000410 dteb7 arbitrary * arbitrary * mtu (ch2) tgi2a h'00000412 dteb6 arbitrary * arbitrary * tgi2b h'00000414 dteb5 arbitrary * arbitrary * mtu (ch1) tgi1a h'00000416 dteb4 arbitrary * arbitrary * tgi1b h'00000418 dteb3 arbitrary * arbitrary * mtu (ch0) tgi0a h'0000041a dteb2 arbitrary * arbitrary * tgi0b h'0000041c dteb1 arbitrary * arbitrary * tgi0c h'0000041e dteb0 arbitrary * arbitrary * tgi0d h'00000420 dtec7 arbitrary * arbitrary * a/d converter (ch0) adi0 h'00000422 dtec6 addr arbitrary * external pin irq0 h'00000424 dtec5 arbitrary * arbitrary * irq1 h'00000426 dtec4 arbitrary * arbitrary * irq2 h'00000428 dtec3 arbitrary * arbitrary * irq3 h'0000042a dtec2 arbitrary * arbitrary * (reserved by system) h'0000042c dtec1 arbitrary * arbitrary * (reserved by system) h'0000042e dtec0 arbitrary * arbitrary * (reserved by system) h'00000430 dted7 arbitrary * arbitrary * (reserved by system) h'00000432 dted6 arbitrary * arbitrary * cmt (ch0) cmi0 h'00000434 dted5 arbitrary * arbitrary * cmt (ch1) cmi1 h'00000436 dted4 arbitrary * arbitrary * low
rev. 2.00, 09/04, page 121 of 720 activating source generator activating source dtc vector address dte bit transfer source transfer destination priority reserved ? h'00000438 to 00000443 ? ? ? high a/d converter (ch1) adi1 h'00000444 dtee5 addr arbitrary * reserved ? h'00000446 ? ? ? sci2 rxi_2 h'00000448 dtee3 rdr_2 arbitrary * txi_2 h'0000044a dtee2 arbitrary * tdr_2 sci3 rxi_3 h'0000044c dtee1 rdr_3 arbitrary * txi_3 h'0000044e dtee0 arbitrary * tdr_3 sci4 rxi_4 h'00000450 dtef7 rdr_4 arbitrary * txi_4 h'00000452 dtef6 arbitrary * tdr_4 mmt tgn h'00000454 dtef5 arbitrary * arbitrary * tgm h'00000456 dtef4 arbitrary * arbitrary * reserved ? h'00000458 ? ? ? hcan2 rm1 h'0000045a dtef2 arbitrary * arbitrary * reserved ? h'0000045c to h'0000049f ? ? ? software write to dtcsr h'0400+ dtvec[7:0] ? arbitrary * arbitrary * low note: * external memory, memory-mapped external devices, on-chip memory, on-chip peripheral modules (excluding dtc) 8.3.3 dtc operation register information is stored in an on-chip ram. when activated, the dtc reads register information in an on-chip ram and transfers data. after the data transfer, it writes updated register information back to the ram. pre-storage of register informati on in the ram makes it possible to transfer data over any required number of channels. the transfer mode can be specified as normal, rep eat, and block transfer mode. setting the chne bit to 1 makes it possible to perform a number of transfers with a single activation source (chain transfer). the 32-bit dtsar designates the dtc transfer source address and the 32-bit dtdar designates the transfer destination addr ess. after each transfer, dtsa r and dtdar are independently incremented, decremented, or left fixed depending on its register information.
rev. 2.00, 09/04, page 122 of 720 yes no yes yes yes yes no no no no start initial settings dtmr, dtcr, dtiar, dtsar, dtdar transfer request generated? nmif = ae = 0? dtc vector read transfer information read dtcra = dtcra ? 1 (normal/block transfer mode) dtcral = dtcral ? 1 (repeat mode) dtsar, dtdar update dtcrb = dtcrb ? 1 (block transfer mode) transfer (1 transfer unit) block transfer mode and dtcrb 0? transfer information write nmi or address error end transfer information write chne = 0? nmif  nmim + ae = 1? when disel = 1 or dtcra = 0 (normal/block transfer mode) when disel = 1 (repeat transfer mode) cpu interrupt request figure 8.5 dtc operation flowchart
rev. 2.00, 09/04, page 123 of 720 normal mode: performs the transfer of one byte, one wo rd, or one longword for each activation. the total transfer count is 1 to 65536. once the specified number of transfers have ended, a cpu interrupt can be requested. table 8.2 normal mode register functions values written back upon a transfer information write register function when dtcra is other than 1 when dtcra is 1 dtmr operation mode control dtmr dtmr dtcra transfer count dtcra ? 1 dtcra ? 1 (= h'0000) dtsar transfer source address increment/decrement/fixed increment/decrement/fixed dtdar transfer destination address increment/decrement/fixed increment/decrement/fixed transfer dtsar dtdar figure 8.6 memory mapping in normal mode
rev. 2.00, 09/04, page 124 of 720 repeat mode: performs the transfer of one byte, one word, or one longword for each activation. either the transfer source or transfer destination is designated as the repeat area. table 8.3 lists the register information in repeat mode. from 1 to 256 transfers can be specified. once the specified number of transfers have ended, the initial state of the transfer counter and the address register specified as the repeat area is restored, and transfer is repeated. in repeat mode the transfer counter value do es not reach h'00, and therefore cpu interrupts cannot be requested when disel = 0. table 8.3 repeat mode register functions values written back upon a transfer information write register function when dtcra is other than 1 when dtcra is 1 dtmr operation mode control dtmr dtmr dtcrah transfer count save dtcrah dtcrah dtcral transfer count dtcral ? 1 dtcrah dtiar initial address (not wri tten back) (not written back) dtsar transfer source address increment/decrement/fixed (dts = 0) increment/ decrement/fixed (dts = 1) dtiar dtdar transfer destination address increment/decrement/fixed (dts = 0) dtiar (dts = 1) increment/ decrement/fixed transfer dtsar or dtdar dtdar or dtsar repeat area figure 8.7 memory mapping in repeat mode
rev. 2.00, 09/04, page 125 of 720 block transfer mode: performs the transfer of one block for each one activation. either the transfer source or transfer destination is designated as the block area. the block length is specified between 1 and 65536. when the transfer of one block ends, the initial state of the block size counter and the address register specified as the block area is restored. the other address register is then incremented, decremented, or left fixed. from 1 to 65,536 transfers can be specified. once the specified numb er of transfers have ended, a cpu interrupt is requested. table 8.4 block transfer mode register functions register function values written b ack upon a transfer information write dtmr operation mode control dtmr dtcra transfer count dtcra ? 1 dtcrb block length (not written back) dtsar transfer source address (dts = 0) increment/ decrement/ fixed (dts = 1) dtsar initial value dtdar transfer destination address (dts = 0) dtdar initial value (dts = 1) increment/ decrement/ fixed transfer dtsar or dtdar dtdar or dtsar block area    first block nth block figure 8.8 memory mapping in block transfer mode
rev. 2.00, 09/04, page 126 of 720 chain transfer: setting the chne bit to 1 enables a numb er of data transfers to be performed consecutively in a single activation source. dtsar, dtdar, dtmr, dtcra, and dtcrb can be set independently. figure 8.9 shows the chain transfer. when activated, the dtc reads the register informa tion start address stored at the vector address, and then reads the first re gister information at that start addre ss. after the data transfer, the chne bit will be tested. when it has been set to 1, dtc reads next register information located in a consecutive area and performs the da ta transfer. these sequences ar e repeated until the chne bit is cleared to 0. in the case of transfer with chne set to 1, an in terrupt request to the cpu is not generated at the end of the specified number of transfers or by setting of the disel bit to 1, and the interrupt source flag for the activatio n source is not affected. dtc vector address source destination source destination register information chne = 1 register information chne = 0 register information start address figure 8.9 chain transfer
rev. 2.00, 09/04, page 127 of 720 8.3.4 interrupt source an interrupt request is issued to the cpu when the dtc finishes the specified number of data transfers, or a data transfer for which the disel bit was set to 1. in the case of interrupt activation, the interrupt set as the activation source is genera ted. these interrupts to the cpu are subject to cpu mask level and interrupt cont roller priority level control. in the case of activation by software, a software activated data transfer end interrupt (swdtend) is generated. when the disel bit is 1 and one data transfer has ended, or the specified number of transfers have ended, after data transfer ends, the swdte bit is held at 1 and an swdtend interrupt is generated. the interrupt handling routine should clear the swdte bit to 0. when the dtc is activated by software, an swdtend interrupt is not generated during a data transfer wait or during da ta transfer even if the swdte bit is set to 1. note: when the dtcr contains a value equal to or greater than 2, the swdte bit is automatically cleared to 0. wh en the dtcr is set to 1, the swdte bit is again set to 1. 8.3.5 operation timing when register information is lo cated in on-chip ram, each mode requires 4 cycles for transfer information reads, and 3 cycles for writes. activating source address vector read transfer information read data transfer rw transfer information write dtc request figure 8.10 dtc operation timing example (normal mode)
rev. 2.00, 09/04, page 128 of 720 8.3.6 dtc execution state counts table 8.5 shows the execution state for one dtc da ta transfer. furthermore, table 8.6 shows the state counts needed for execution state. table 8.5 execution state of dtc mode vector read i register information read/write j data read k data write l internal operation m normal 1 7 1 1 1 repeat 1 7 1 1 1 block transfer 1 7 n n 1 n: block size (default set values of dtcrb) table 8.6 state counts n eeded for execution state access objective on-chip ram on-chip rom internal i/o register external device bus width 32 32 32 32 8 access state 1 1 2 * 1 3 * 2 2 vector read s i ? 1 ? ? 4 register information read/write s j 1 1 ? ? 8 byte data read s k 1 1 2 3 2 word data read s k 1 1 2 3 4 long word data read s k 1 1 4 6 8 byte data write s l 1 1 2 3 2 word data write s l 1 1 2 3 4 longword data write s l 1 1 4 6 8 execution state internal operation s m 1 1 1 1 1 notes: 1. two state access modul e: port, int, cmt, sci, etc. 2. three state access module: wdt, ubc, etc. the execution state count is calcul ated using the following formula. indicates the number of transfers by one ac tivating source (count + 1 when chne bit is set to 1). execution state count = i s i + (j s j + k s k + l s l ) + m s m
rev. 2.00, 09/04, page 129 of 720 8.4 procedures for using dtc 8.4.1 activation by interrupt the procedure for using the dtc with interrupt activation is as follows: 1. set the dtmr, dtcra, dtsar, dtdar, dtcrb, and dtiar register information in memory space. 2. establish the register information start address with dtbr and the dtc vector table. 3. set the corresponding dter bit to 1. 4. the dtc is activated when an interrupt source occurs. 5. when interrupt requests are not made to the cp u, the interrupt source is cleared, but the dter is not. when interrupts are requested, the inte rrupt source is not cleared, but the dter is. 6. interrupt sources are cleared within the cpu interrupt routine. when doing continuous dtc data transfers, set the dter to 1. 8.4.2 activation by software the procedure for using the dtc with software activation is as follows: 1. set the dtmr, dtcra, dtsar, dtdar, dtcrb, and dtiar register information in memory space. 2. set the start address of the register information in the dtc vector address. 3. check that the swdte bit is 0. 4. write 1 to swdte bit and the vector number to dtvec. 5. check the vector number written to dtvec. 6. after the end of one data transfer, if the disel bit is 0 and a cpu interrupt is not requested, the swdte bit is cleared to 0. if the dtc is to continue transferring data, set the swdte bit to 1. when the disel bit is 1, or after the speci fied number of data transfers have ended, the swdte bit is held at 1 and a cpu interrupt is requested. 7. the swdte bit is cleared to 0 within the cpu interrupt routine. for continuous dtc data transfer, set the swdte bit to 1 after confirming that its current value is 0. then write the vector number to dtvec fo r continuous dtc transfer.
rev. 2.00, 09/04, page 130 of 720 8.4.3 dtc use example the following is a dtc use example of a 128-byte data reception by the sci: 1. the settings are: dtmr so urce address fixed (sm1 = sm0 = 0), destination address incremented (dm1 = 1, dm0 = 0), normal mode (md1 = md0 = 0), byte size (sz1 = sz0 = 0), one transfer per activating source (chne = 0), and a cpu interrupt request after the designated number of data transfers (disel = 0). dts bit can be set to any value. 128 (h'0080) is set in dtcra, the rdr address of th e sci is set in dtsar, and the start address of the ram storing the receive data is se t in dtdar. dtcrb can be set to any value. 2. set the register information start addr ess with dtbr and the dtc vector table. 3. set the corresponding dter bit to 1. 4. set the sci to the appropriate receive mode. set the rie bit in scr to 1 to enable the reception complete (rxi) interrupt. since the generation of a receive error duri ng the sci reception operation will disable subsequent reception, th e cpu should be enabled to accept receive error interrupts. 5. each time reception of one byte of data ends on the sci, the rdrf flag in ssr is set to 1, an rxi interrupt is generated, and the dtc is activ ated. the receive data is transferred from rdr to ram by the dtc. dtdar is incremented an d dtcra is decremented. the rdrf flag is automatically cleared to 0. 6. when dtcra is 0 after the 128 data transfers have ended, the rdrf flag is held at 1, the dter bit is cleared to 0, and an rxi interrup t request is sent to the cpu. the interrupt handling routine should perform completion processing.
rev. 2.00, 09/04, page 131 of 720 8.5 cautions on use 8.5.1 prohibition against dtc register access by dtc dtc register access by the dtc is prohibited. 8.5.2 module standby mode setting dtc operation can be disabled or enabled using the module standby control register. the initial setting is for dtc operation to be halted. regist er access is enabled by clearing module standby mode. when the mstp24 and mstp25 bits in mstcr1 ar e set to 1, the dtc clock is halted and the dtc enters module standby mode. do not write 1 on mstp24 bit or mstp25 bit during activation of the dtc. for details, refer to section 24, power-down modes. 8.5.3 on-chip ram the dtmr, dtsar, dtdar, dtcra, dtcrb and dt iar registers are all located in on-chip ram. when the dtc is used, the rame b it in syscr must not be cleared to 0.
rev. 2.00, 09/04, page 132 of 720
rev. 2.00, 09/04, page 133 of 720 section 9 bus state controller (bsc) the bus state controller (bsc) divides up the address spaces and outputs control for various types of memory. this enables memories like sram and rom to be linked directly to the chip without external circuitry. 9.1 features the bsc has the following features: ? address space is divided into four spaces ? a maximum linear 256-kbyte bus width (8 bits) for both on-chip rom enabled mode and on-chip rom disabled mode , as for address space cs0 ? wait states can be inserted by software for each space ? wait state insertion with wait pin in external memory space access ? outputs control signals for each space accor ding to the type of memory connected ? on-chip rom and ram interfaces ? on-chip rom and ram access of 32 bits in 1 state figure 9.1 shows the bsc block diagram.
rev. 2.00, 09/04, page 134 of 720 ramer wcr1 bcr1 bcr2 internal bus module bus bus interface on-chip memory control unit memory control unit wait control unit area control unit wrl cs0 rd wait bsc wcr1: wait control register 1 bcr1: bus control register 1 bcr2: bus control register 2 ramer: ram emulation register figure 9.1 bsc block diagram
rev. 2.00, 09/04, page 135 of 720 9.2 input/output pin table 9.1 shows the bus state controller pin configuration. table 9.1 pin configuration name abbr. i/o description address bus a17 to a0 o address output data bus d7 to d0 i/o 8-bit data bus chip select cs0 o chip select signal indicating the area being accessed read rd o strobe that indicates the read cycle lower write wrl o strobe that indicates a write cycle to the lower 8 bits (d7 to d0) wait wait i wait state request signal bus request breq i bus release request input bus acknowledge back o bus use enable output 9.3 register configuration the bsc has four registers. for de tails on these register addresse s and register states in each processing states, refer to appendix a, internal i/o register. these registers are used to control wait states, bus width, and interfaces with memories like rom and sram. all registers are 16 bits. ? bus control register 1 (bcr1) ? bus control register 2 (bcr2) ? wait control register 1 (wcr1) ? ram emulation register (ramer)
rev. 2.00, 09/04, page 136 of 720 9.4 address map figure 9.2 shows the address format used by this lsi. output address: output from the address pins cs space selection: decoded, outputs cs0 when a31 to a24 = 00000000 space selection: not output externally; used to select the type of space on-chip rom space or cs0 space when 00000000 (h'00) reserved (do not access) when 00000001 to 11111110 (h'01 to h'fe) on-chip peripheral module space or on-chip ram space when 11111111 (h'ff) a31 to a24 a23, a22 a21 to a18 a0 a17 figure 9.2 address format this chip uses 32-bit addresses: ? bits a31 to a24 are used to select the t ype of space and are not output externally. ? bits a23 and a22 are decoded and output as chip select signals ( cs0 ) for the corresponding areas when bits a31 to a24 are 00000000. ? a17 to a0 are output externally. a21 to a18 are not output externally. table 9.2 shows the address map.
rev. 2.00, 09/04, page 137 of 720 table 9.2 address map ? on-chip rom enabled mode size address space * memory sh7047f sh7049 bus width h'0000 0000 to h'0000 ffff 64 kb ytes 64 kbytes 32 bits h'0001 0000 to h'0001 ffff 64 kb ytes 64 kbytes 32 bits h'0002 0000 to h'0003 ffff on-chip rom on-chip rom 128 kbytes reserved 32 bits h'0004 0000 to h'001f ffff reserved reserved reserved reserved h'0020 0000 to h'0023 ffff cs0 space external space 256 kbytes 256 kbytes 8 bits h'0024 0000 to h'ffff 7fff reserved reserved h'ffff 8000 to h'ffff bfff on-chip peripheral module on-chip peripheral module 16 kbytes 16kbytes 8, 16 bits h'ffff c000 to h'ffff cfff reserved reserved h'ffff d000 to h'ffff dfff 4 kbytes reserved 32 bits h'ffff e000 to h'ffff efff 4 kbytes 4 kbytes 32 bits h'ffff f000 to h'ffff ffff on-chip ram on-chip ram 4 kbytes 4 kbytes 32 bits ? on-chip rom disabled mode size address space * memory sh7047f sh7049 bus width h'0000 0000 to h'0003 ffff cs0 space external space 256 kbytes 256 kbytes 8 bits h'0004 0000 to h'ffff 7fff reserved reserved h'ffff 8000 to h'ffff bfff on-chip peripheral module on-chip peripheral module 16 kbytes 16 kbytes 8, 16 bits h'ffff c000 to h'ffff cfff reserved reserved h'ffff d000 to h'ffff dfff 4 kbytes reserved 32 bits h'ffff e000 to h'ffff efff 4 kbytes 4 kbytes 32 bits h'ffff f000 to h'ffff ffff on-chip ram on-chip ram 4 kbytes 4 kbytes 32 bits note: * do not access reserved spaces. operation c annot be guaranteed if they are accessed. when in single chip mode, spaces other than those for on-chip rom, on-chip ram, and on-chip peripheral modules are not available.
rev. 2.00, 09/04, page 138 of 720 9.5 description of registers 9.5.1 bus control register 1 (bcr1) bcr1 is a 16-bit readable/writable register that enables access to the mmt and mtu control registers and specifies the bus size of the cs0 space. the aosz bit of bcr1 is written to during the initialization stage after a power-on reset. do not change the values thereafter. in on-chip rom enabled mode, do not access any of the cs0 space until completion of register initialization. bit bit name initial value r/w description 15 ? 0 r reserved this bit is always read as 0 and should always be written with 0. 14 mmtrwe 1 r/w mmt read/write enable this bit enables mmt control register access. for details, refer to mmt section. 0: mmt control register access is disabled 1: mmt control register access is enabled 13 mturwe 1 r/w mtu read/write enable this bit enables mtu control register access. for details, refer to mtu section. 0: mtu control register access is disabled 1: mtu control register access is enabled 12 to 8 ? all 0 r reserved these bits are always read as 0 and should always be written with 0. 7 to 4 ? all 0 r reserved these bits are always read as 0 and should always be written with 0. 3 to 1 ? all 1 r reserved these bits are always read as 1 and should always be written with 1. 0 a0sz 1 r/w in on-chip rom enabled mode, 0 should be written to this bit to specify a bus size of 8 bits before the cs0 space is accessed. note: in on-chip rom disabled mode, the cs0 space bus size is specified by the mode pin.
rev. 2.00, 09/04, page 139 of 720 9.5.2 bus control register 2 (bcr2) bcr2 is a 16-bit readable/writable register that specifies the number of idle cycles and cs0 signal assert extension of each cs0 space. bit bit name initial value r/w description 15 to 10 ? all 1 r reserved these bits are always read as 1 and should always be written with 1. 9 8 iw01 iw00 1 1 r/w r/w idle specification between cycles these bits insert idle cycles when a read access is followed immediately by a write access. 00: no cs0 space idle cycle 01: one cs0 space idle cycle 10: two cs0 space idle cycles 11: three cs0 space idle cycles 7 to 5 ? all 1 r reserved these bits are always read as 1 and should always be written with 1. 4 cw0 1 r/w idle specification for continuous access the continuous access idle specification makes insertions to clearly delineate the bus intervals by once negating the cs0 signal when performing consecutive accesses to the same cs space. 0: no cs0 space continuous access idle cycles 1: one cs0 space conti nuous access idle cycle when a write immediately follows a read, the number of idle cycles inserted is t he larger of the two values specified by iwo1 and iwo0. 3 to 1 ? all 1 r reserved these bits are always read as 1 and should always be written with 1. 0 sw0 1 r/w cs assert extension specification the cs assert cycle extension specification is for making insertions to prevent extension of the rd signal or wrl signal assert period beyond the length of the cs0 signal assert period. 0: no cs0 space cs assert extension 1: cs0 space cs assert extension (one cycle is inserted before and after each bus cycle)
rev. 2.00, 09/04, page 140 of 720 9.5.3 wait control register 1 (wcr1) wcr1 is a 16-bit readable/writable register that specifies the number of wait cycles for cs0 space. bit bit name initial value r/w description 15 to 4 ? all 1 r/w reserved these bits are always read as 1 and should always be written with 1. 3 2 1 0 w03 w02 w01 w00 1 1 1 1 r/w r/w r/w r/w cs0 space wait specification these bits specify the numbe r of waits for cs0 space access. 0000: no wait (external wait input disabled) 0001: one wait (external wait input enabled) . . . 1111: 15 wait (external wait input enabled) 9.5.4 ram emulation register (ramer) the ram emulation register (ramer ) is a 16-bit readable/writable register that selects the ram area to be used when emulating realtime programming of flash memory. for details, refer to section 19.5.5, ram emulation register (ramer).
rev. 2.00, 09/04, page 141 of 720 9.6 accessing external space a strobe signal is output in ex ternal space accesses to provide pr imarily for sram or rom direct connections. 9.6.1 basic timing external access bus cycles are perf ormed in 2 states. figure 9.3 s hows the basic timing of external space access. write data wrl data rd cs0 address ck read t1 t2 figure 9.3 basic timing of external space access during a read, irrespective of operand size, all bits (8 bits in this lsi) in the data bus width for the access space (address) accessed by rd signal are fetched by the lsi. during a write, the wrl (bits 7 to 0) signal indicates the byte location to be written.
rev. 2.00, 09/04, page 142 of 720 9.6.2 wait state control the number of wait states inse rted into external space access states can be controlled using the wcr1 settings. the speci fied number of t w cycles are inserted as so ftware cycles at the timing shown in figure 9.4. write data wrl data rd cs0 address ck read t1 tw t2 figure 9.4 wait state timing of ext ernal space access (s oftware wait only)
rev. 2.00, 09/04, page 143 of 720 when the wait is specified by software using wcr1, the wait input wait signal from outside is sampled. figure 9.5 shows the wait signal sampling. the wait signal is sampled at the clock rise one cycle before the clock rise when the t w state shifts to the t 2 state. when using external waits, use a wcr1 setting of 1 state or more in case of extending cs assertion, and 2 states or more otherwise. write data wrl wait data rd cs0 address ck read t1 tw tw two t2 figure 9.5 wait state timing of external space access (two so ftware wait states + wait signal wait state)
rev. 2.00, 09/04, page 144 of 720 9.6.3 cs assert period extension idle cycles can be inserted to prevent extension of the rd or wrl signal assert period beyond the length of the cs0 signal assert period by setting the sw0 bit of bcr2. this allows for flexible interfaces with external circuitry. the timing is shown in figure 9.6. t h and t f cycles are added respectively before and after the normal cycle. only cs0 is asserted in these cycles; rd and wrl signals are not. further, data is extended up to the t f cycle, which is effective for gate arrays and the like, which have slower write operations. write data wrl data rd cs0 address ck read th t1 t2 tf figure 9.6 cs assert period extension function
rev. 2.00, 09/04, page 145 of 720 9.7 waits between access cycles when a read from a slow device is completed, data buffers may not go off in time, causing conflict with the next access data. if there is a data co nflict during memory acces s, the problem can be solved by inserting a wa it in the access cycle. to enable detection of bus cycle starts, waits can be inserted between access cycles during continuous accesses of the sa me cs0 space by negating the cs0 signal once. 9.7.1 prevention of data bus conflicts waits are inserted so that the number of write cy cles after read cycle and the number of cycles specified by iw01 or iw00 bits of bcr can be in serted. when idle cycles already exist between access cycles, only the number of empty cycles re maining beyond the specif ied number of idle cycles are inserted. 9.7.2 simplification of bus cycle start detection for consecutive accesses to the same cs0 space, wait s are inserted to provid e the number of idle cycles designated by bit cw0 in bcr2. however, in the case of a write cycle after a read, the number of idle cycles inserted will be the larger of the two values designated by the iw and cw bits. when idle cycles already exist betw een access cycles, waits are not inserted. figure 9.7 shows an example. a continuous access idle is specifi ed for cs0 space, and cs0 space is consecutively write-accessed. data cs0 space access idle cycle cs0 space access wrl rd cs0 address ck t1 t2 tidle t1 t2 figure 9.7 example of idle cycle inse rtion at same space consecutive access
rev. 2.00, 09/04, page 146 of 720 9.8 bus arbitration this lsi has a bus arbitration function that, wh en a bus release request is received from an external device, releases the bus to that device. it also has three internal bus masters, the cpu, dtc, and aud (only for flash version). the prio rity for arbitrate the bus mastership between these bus masters is: bus request from external device > aud > dtc > cpu a bus request by an external device should be input to the breq pin. when the breq pin is asserted, this lsi releases the bus immediately after the bus cycl e being executed is completed. the signal indicating that the bus has been released is output from the back pin. however, the bus is not released between the read and write cycles during tas instruction execution. bus arbitration is not executed between multiple bus cycl es that occur due to the data bus width smaller than access size, for instance, bus cycles in which 8-bit memory is accessed by a longword. the bus may be returned when this lsi is releasi ng the bus. that is, when interrupt request occurs to be processed. this lsi incorporates the irqout pin for the bus request signal. when the bus must be returned to this lsi, the irqout signal can be asserted. the device that is asserting an external bus-release request negates the breq signal to release the bus when the irqout signal is asserted. as a result, the bus is re turned to and processed by this lsi. the asserting condition of the irqout pin is that an interrupt source occurs and the interrupt request level is higher than that of interrupt mask bits i3 to i0 in status register sr. figure 9.8 shows the bus mastership release procedure.
rev. 2.00, 09/04, page 147 of 720 this lsi breq accepted bus release response strobe pin: high-level output external device bus request bus mastership acquisition back confirmation bus mastership release status breq = low back = low address, data, strobe pin: high impedance figure 9.8 bus mastership release procedure 9.9 memory connection example sh7047 cs0 rd a0 to a14 d0 to d7 ce oe a0 to a14 i/o0 to i/o7 32 k 8-bit rom figure 9.9 example of 8-bit data bus width rom connection
rev. 2.00, 09/04, page 148 of 720 9.10 on-chip peripheral i/o register access on-chip peripheral i/o re gisters are accessed from the bus state controller, as shown in table 9.3. table 9.3 on-chip peripheral i/o register access on-chip peripheral module sci mtu, poe intc pfc, port cmt a/d ubc wdt dtc mmt hcan2 h-udi connected bus width 8bit 16bit 16bit 16bit 16bit 16bit 16bit 16bit 16bit 16bit 16bit 16bit access cycle 2cyc * 1 2cyc * 1 2cyc * 2 2cyc * 2 2cyc * 1 2cyc * 1 3cyc * 2 3cyc * 2 3cyc * 2 2cyc * 1 8cyc * 2 2cyc * 1 notes: 1. converted to the peripheral clock. 2. converted to the system clock. 9.11 cycles in which bus is not released 1. one bus cycle: the bus is never released during a single bus cy cle. for example, in the case of a longword read (or write) in 8-b it normal space, the fo ur memory accesses to the 8-bit normal space constitute a single bus cycle, and the bus is never released during this period. assuming that one memory access requires two states, the bus is not released during an 8-state period. 8 bit 8 bit 8 bit 8 bit cycles in which bus is not released figure 9.10 one bus cycle 9.12 cpu operation when program is in external memory in this lsi, two words (equivalent to two instruc tions) are normally fetched in a single instruction fetch. this is also true when the program is located in external memory, irrespective of whether the external memory bus width is 8 or 16 bits. if the program counter value immediately after th e program branched is an odd-word (2n+1) address, or if the program counter value immediat ely before the program br anches is an even-word (2n) address, the cpu will always fetch 32 bits (equivalent to two instructions) that include the respective word instruction.
rev. 2.00, 09/04, page 149 of 720 section 10 multi-functio n timer pulse unit (mtu) this lsi has an on-chip multi-function timer pulse unit (mtu) that comprises five 16-bit timer channels. the block diagram is shown in figure 10.1. 10.1 features ? maximum 16-pulse input/output ? selection of 8 counter input clocks for each channel ? the following operations can be set for each channel: ? waveform output at compare match ? input capture function ? counter clear operation multiple timer counters (tcnt) can be written to simultaneously simultaneous clearing by compare match and input capture is possible register simultaneous input/output is possible by synchronous counter operation ? a maximum 12-phase pwm output is possible in combination with synchronous operation ? buffer operation settable for channels 0, 3, and 4 ? phase counting mode settable independently for each of channels 1 and 2 ? cascade connection operation ? fast access via internal 16-bit bus ? 23 interrupt sources ? automatic transfer of register data ? a/d converter conversion start trigger can be generated ? module standby mode can be set ? positive and negative 3-phase waveforms (6-phase waveforms in total) can be output by channel 3 and channel 4 connected in complementary pwm or reset pwm mode ? ac synchronous motor (brushless dc motor) drive mode can be set by channel 0, channel 3, and channel 4 connected in complementary pwm or reset pwm mode. ? selection of chopping or level waveform outputs in ac synchronous motor drive mode
rev. 2.00, 09/04, page 150 of 720 table 10.1 mtu functions item channel 0 channel 1 ch annel 2 channel 3 channel 4 count clock p /1 p /4 p /16 p /64 tclka tclkb tclkc tclkd p /1 p /4 p /16 p /64 p /256 tclka tclkb p /1 p /4 p /16 p /64 p /1024 tclka tclkb tclkc p /1 p /4 p /16 p /64 p /256 p /1024 tclka tclkb p /1 p /4 p /16 p /64 p /256 p /1024 tclka tclkb general registers tgra_0 tgrb_0 tgra_1 tgrb_1 tgra_2 tgrb_2 tgra_3 tgrb_3 tgra_4 tgrb_4 general registers/ buffer registers tgrc_0 tgrd_0 ? ? tgrc_3 tgrd_3 tgrc_4 tgrd_4 i/o pins tioc0a tioc0b tioc0c tioc0d tioc1a tioc1b tioc2a tioc2b tioc3a tioc3b tioc3c tioc3d tioc4a tioc4b tioc4c tioc4d counter clear function tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture 0 output 1 output compare match output toggle output input capture function synchronous operation pwm mode 1 pwm mode 2 ? ? complementary pwm mode ? ? ? reset synchronous pwm mode ? ? ? ac synchronous motor drive mode ? ? phase counting mode ? ? ? buffer operation ? ?
rev. 2.00, 09/04, page 151 of 720 item channel 0 channel 1 ch annel 2 channel 3 channel 4 dtc activation tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture and tcnt overflow underflow a/d converter start trigger tgra_0 compare match or input capture tgra_1 compare match or input capture tgra_2 compare match or input capture tgra_3 compare match or input capture tgra_4 compare match or input capture interrupt sources 5 sources ? compare match or input capture 0a ? compare match or input capture 0b ? compare match or input capture 0c ? compare match or input capture 0d ? overflow 4 sources ? compare match or input capture 1a ? compare match or input capture 1b ? overflow ? underflow 4 sources ? compare match or input capture 2a ? compare match or input capture 2b ? overflow ? underflow 5 sources ? compare match or input capture 3a ? compare match or input capture 3b ? compare match or input capture 3c ? compare match or input capture 3d ? overflow 5 sources ? compare match or input capture 4a ? compare match or input capture 4b ? compare match or input capture 4c ? compare match or input capture 4d ? overflow or underflow notes: : possible ? : not possible
rev. 2.00, 09/04, page 152 of 720 internal data bus a/d converter conversion start signal tcnt tgra tgrb tgrc tgrd tcr tiorh tier tmdr tiorl tsr channel 3 tcnt tgra tgrb tgrc tgrd tmdr tiorl tsr tcr tiorh tier channel 4 tcnts tcdr tcbr tddr toer tocr tgcr bus i/f common tcnt tgra tgrb tmdr tsr tcr tior tier tsyr tstr channel 2 tcnt tgra tgrb tmdr tsr tcr tior tier channel 1 tcnt tgra tgrb tgrc tgrd tmdr tiorl tsr tcr tiorh tier channel 0 control logic module data bus control logic for channel 0 to 2 control logic for channels 3 and 4 [legend] tstr: tsyr: tcr: tmdr: tior (h, l): timer start register timer synchro register timer control register timer mode register timer i/o control registers (h, l) tier: tsr: tcnt: tgr (a, b, c, d): timer interrupt enable register timer status register timer counter timer general registers (a, b, c, d) interrupt request signals channel 3: channel 4: tgi3a tgi3b tgi3c tgi3d tci3v tgi4a tgi4b tci4c tci4d tgi4v interrupt request signals channel 0: channel 1: channel 2: tgi0a tgi0b tgi0c tgi0d tci0v tgi1a tgi1b tci1v tci1u tgi2a tgi2b tci2v tci2u tioc0a tioc0b tioc0c tioc0d tioc1a tioc1b tioc2a tioc2b input/output pins channel 0: channel 1: channel 2: p /1 p /4 p /16 p /64 p /256 p /1024 tclka tclkb tclkc tclkd clock input internal clock: external clock: tioc3a tioc3b tioc3c tioc3d tioc4a tioc4b tioc4c tioc4d input/output pins channel 3: channel 4: figure 10.1 block diagram of mtu
rev. 2.00, 09/04, page 153 of 720 10.2 input/output pins table 10.2 mtu pins channel symbol i/o function common tclka input external clock a input pin (channel 1 phase counting mode a phase input) tclkb input external clock b input pin (channel 1 phase counting mode b phase input) tclkc input external clock c input pin (channel 2 phase counting mode a phase input) tclkd input external clock d input pin (channel 2 phase counting mode b phase input) 0 tioc0a i/o tgra_0 input capture inpu t/output compare output/pwm output pin tioc0b i/o tgrb_0 input capture inpu t/output compare output/pwm output pin tioc0c i/o tgrc_0 input capture inpu t/output compare output/pwm output pin tioc0d i/o tgrd_0 input capture inpu t/output compare output/pwm output pin 1 tioc1a i/o tgra_1 input capture inpu t/output compare output/pwm output pin tioc1b i/o tgrb_1 input capture inpu t/output compare output/pwm output pin 2 tioc2a i/o tgra_2 input capture inpu t/output compare output/pwm output pin tioc2b i/o tgrb_2 input capture inpu t/output compare output/pwm output pin 3 tioc3a i/o tgra_3 input capture inpu t/output compare output/pwm output pin tioc3b i/o tgrb_3 input capture inpu t/output compare output/pwm output pin tioc3c i/o tgrc_3 input capture inpu t/output compare output/pwm output pin tioc3d i/o tgrd_3 input capture inpu t/output compare output/pwm output pin 4 tioc4a i/o tgra_4 input capture inpu t/output compare output/pwm output pin tioc4b i/o tgrb_4 input capture inpu t/output compare output/pwm output pin tioc4c i/o tgrc_4 input capture inpu t/output compare output/pwm output pin tioc4d i/o tgrd_4 input capture inpu t/output compare output/pwm output pin
rev. 2.00, 09/04, page 154 of 720 10.3 register descriptions the mtu has the following registers. for details on register addresses and register states during each process, refer to appendix a, internal i/o register. to distin guish registers in each channel, an underscore and the channel number are added as a suffix to the register name; tcr for channel 0 is expressed as tcr_0. ? timer control register_0 (tcr_0) ? timer mode register_0 (tmdr_0) ? timer i/o control register h_0 (tiorh_0) ? timer i/o control register l_0 (tiorl_0) ? timer interrupt enable register_0 (tier_0) ? timer status register_0 (tsr_0) ? timer counter_0 (tcnt_0) ? timer general register a_0 (tgra_0) ? timer general register b_0 (tgrb_0) ? timer general register c_0 (tgrc_0) ? timer general register d_0 (tgrd_0) ? timer control register_1 (tcr_1) ? timer mode register_1 (tmdr_1) ? timer i/o control register _1 (tior_1) ? timer interrupt enable register_1 (tier_1) ? timer status register_1 (tsr_1) ? timer counter_1 (tcnt_1) ? timer general register a_1 (tgra_1) ? timer general register b_1 (tgrb_1) ? timer control register_2 (tcr_2) ? timer mode register_2 (tmdr_2) ? timer i/o control register_2 (tior_2) ? timer interrupt enable register_2 (tier_2) ? timer status register_2 (tsr_2) ? timer counter_2 (tcnt_2) ? timer general register a_2 (tgra_2) ? timer general register b_2 (tgrb_2) ? timer control register_3 (tcr_3) ? timer mode register_3 (tmdr_3) ? timer i/o control register h_3 (tiorh_3) ? timer i/o control register l_3 (tiorl_3)
rev. 2.00, 09/04, page 155 of 720 ? timer interrupt enable register_3 (tier_3) ? timer status register_3 (tsr_3) ? timer counter_3 (tcnt_3) ? timer general register a_3 (tgra_3) ? timer general register b_3 (tgrb_3) ? timer general register c_3 (tgrc_3) ? timer general register d_3 (tgrd_3) ? timer control register_4 (tcr_4) ? timer mode register_4 (tmdr_4) ? timer i/o control register h_4 (tiorh_4) ? timer i/o control register l_4 (tiorl_4) ? timer interrupt enable register_4 (tier_4) ? timer status register_4 (tsr_4) ? timer counter_4 (tcnt_4) ? timer general register a_4 (tgra_4) ? timer general register b_4 (tgrb_4) ? timer general register c_4 (tgrc_4) ? timer general register d_4 (tgrd_4) common registers ? timer start register (tstr) ? timer synchro register (tsyr) common registers for timers 3 and 4 ? timer output master enable register (toer) ? timer output control enable register (tocr) ? timer gate control register (tgcr) ? timer cycle data register (tcdr) ? timer dead time data register (tddr) ? timer subcounter (tcnts) ? timer cycle buffer register (tcbr)
rev. 2.00, 09/04, page 156 of 720 10.3.1 timer control register (tcr) the tcr registers are 8-bit readab le/writable registers that cont rol the tcnt operation for each channel. the mtu has a total of five tcr regist ers, one for each channel (channel 0 to 4). tcr register settings should be conducted only when tcnt operation is stopped. bit bit name initial value r/w description 7 6 5 cclr2 cclr1 cclr0 0 0 0 r/w r/w r/w counter clear 0 to 2 these bits select the tcnt c ounter clearing source. see tables 10.3 and 10.4 for details. 4 3 ckeg1 ckeg0 0 0 r/w r/w clock edge 0 and 1 these bits select the input cl ock edge. when the input clock is counted using both edges, the input clock period is halved (e.g. p /4 both edges = p /2 rising edge). if phase counting mode is used on channels 1 and 2, this setting is ignored and the phase counting mode setting has priority. internal clock edge selection is valid when the input clock is p /4 or slower. when p /1, or the overflow/underflow of another channel is selected for the input clock, although values can be written, counter operation comp iles with the initial value. 00: count at rising edge 01: count at falling edge 1x: count at both edges [legend] x: don?t care 2 1 0 tpsc2 tpsc1 tpsc0 0 0 0 r/w r/w r/w time prescaler 0 to 2 these bits select the tcnt c ounter clock. the clock source can be selected independently for each channel. see tables 10.5 to 10.8 for details.
rev. 2.00, 09/04, page 157 of 720 table 10.3 cclr0 to cclr2 (channels 0, 3, and 4) channel bit 7 cclr2 bit 6 cclr1 bit 5 cclr0 description 0, 3, 4 0 0 0 tcnt clearing disabled 1 tcnt cleared by tgra compare match/input capture 1 0 tcnt cleared by tgrb compare match/input capture 1 tcnt cleared by counter clearing for another channel performing synchronous clearing/ synchronous operation * 1 1 0 0 tcnt clearing disabled 1 tcnt cleared by tgrc compare match/input capture * 2 1 0 tcnt cleared by tgrd compare match/input capture * 2 1 tcnt cleared by counter clearing for another channel performing synchronous clearing/ synchronous operation * 1 notes: 1. synchronous operation is set by setting the sync bit in tsyr to 1. 2. when tgrc or tgrd is used as a buffer re gister, tcnt is not cleared because the buffer register setting has priority, and comp are match/input capture does not occur. table 10.4 cclr0 to cclr2 (channels 1 and 2) channel bit 7 reserved * 2 bit 6 cclr1 bit 5 cclr0 description 1, 2 0 0 0 tcnt clearing disabled 1 tcnt cleared by tgra compare match/input capture 1 0 tcnt cleared by tgrb compare match/input capture 1 tcnt cleared by counter clearing for another channel performing synchronous clearing/ synchronous operation * 1 notes: 1. synchronous operation is select ed by setting the sync bit in tsyr to 1. 2. bit 7 is reserved in channels 1 and 2. it is always read as 0. writing is ignored.
rev. 2.00, 09/04, page 158 of 720 table 10.5 tpsc0 to tpsc2 (channel 0) channel bit 2 tpsc2 bit 1 tpsc1 bit 0 tpsc0 description 0 0 0 0 internal clock: counts on p /1 1 internal clock: counts on p /4 1 0 internal clock: counts on p /16 1 internal clock: counts on p /64 1 0 0 external clock: counts on tclka pin input 1 external clock: counts on tclkb pin input 1 0 external clock: counts on tclkc pin input 1 external clock: counts on tclkd pin input table 10.6 tpsc0 to tpsc2 (channel 1) channel bit 2 tpsc2 bit 1 tpsc1 bit 0 tpsc0 description 1 0 0 0 internal clock: counts on p /1 1 internal clock: counts on p /4 1 0 internal clock: counts on p /16 1 internal clock: counts on p /64 1 0 0 external clock: counts on tclka pin input 1 external clock: counts on tclkb pin input 1 0 internal clock: counts on p /256 1 counts on tcnt_2 overflow/underflow note: this setting is ignored when channel 1 is in phase counting mode.
rev. 2.00, 09/04, page 159 of 720 table 10.7 tpsc0 to tpsc2 (channel 2) channel bit 2 tpsc2 bit 1 tpsc1 bit 0 tpsc0 description 2 0 0 0 internal clock: counts on p /1 1 internal clock: counts on p /4 1 0 internal clock: counts on p /16 1 internal clock: counts on p /64 1 0 0 external clock: counts on tclka pin input 1 external clock: counts on tclkb pin input 1 0 external clock: counts on tclkc pin input 1 internal clock: counts on p /1024 note: this setting is ignored when channel 2 is in phase counting mode. table 10.8 tpsc0 to tpsc2 (channels 3 and 4) channel bit 2 tpsc2 bit 1 tpsc1 bit 0 tpsc0 description 3, 4 0 0 0 internal clock: counts on p /1 1 internal clock: counts on p /4 1 0 internal clock: counts on p /16 1 internal clock: counts on p /64 1 0 0 internal clock: counts on p /256 1 internal clock: counts on p /1024 1 0 external clock: counts on tclka pin input 1 external clock: counts on tclkb pin input
rev. 2.00, 09/04, page 160 of 720 10.3.2 timer mode register (tmdr) the tmdr registers are 8-bit readab le/writable registers that are used to set the operating mode of each channel. the mtu has five tmdr registers, one for each channel. tmdr register settings should be changed only when tcnt operation is stopped. bit bit name initial value r/w description 7, 6 ? all 1 ? reserved these bits are always read as 1, and should only be written with 1. 5 bfb 0 r/w buffer operation b specifies whether tgrb is to operate in the normal way, or tgrb and tgrd are to be used together for buffer operation. when tgrd is used as a buffer register, tgrd input capture/output co mpare is not generated. in channels 1 and 2, which have no tgrd, bit 5 is reserved. it is always read as 0, and should only be written with 0. 0: tgrb and tgrd operate normally 1: tgrb and tgrd used together for buffer operation 4 bfa 0 r/w buffer operation a specifies whether tgra is to operate in the normal way, or tgra and tgrc are to be used together for buffer operation. when tgrc is used as a buffer register, tgrc input capture/output co mpare is not generated. in channels 1 and 2, which have no tgrc, bit 4 is reserved. it is always read as 0, and should only be written with 0. 0: tgra and tgrc operate normally 1: tgra and tgrc used together for buffer operation 3 2 1 0 md3 md2 md1 md0 0 0 0 0 r/w r/w r/w r/w modes 0 to 3 these bits are used to set the timer operating mode. see table 10.9 for details.
rev. 2.00, 09/04, page 161 of 720 table 10.9 md0 to md3 bit 3 md3 bit 2 md2 bit 1 md1 bit 0 md0 description 0 0 0 0 normal operation 1 reserved (do not set) 1 0 pwm mode 1 1 pwm mode 2 * 1 1 0 0 phase counting mode 1 * 2 1 phase counting mode 2 * 2 1 0 phase counting mode 3 * 2 1 phase counting mode 4 * 2 1 0 0 0 reset synchronous pwm mode * 3 1 reserved (do not set) 1 x reserved (do not set) 1 0 0 reserved (do not set) 1 complementary pwm mode 1 (transmit at peak) * 3 1 0 complementary pwm mode 2 (transmit at bottom) * 3 1 complementary pwm mode 2 (transmit at peak and bottom) * 3 [legend] x: don?t care notes: 1. pwm mode 2 can not be set for channels 3, 4. 2. phase counting mode cannot be set for channels 0, 3, and 4. 3. reset synchronous pwm mode, complementary pwm mode can only be set for channel 3. when channel 3 is set to reset synchronous pwm mode or complementary pwm mode, the channel 4 settings become ine ffective and automatically conform to the channel 3 settings. however, do not set ch annel 4 to reset synchronous pwm mode or complementary pwm mode. reset synchronous pwm mode and complementary pwm mode cannot be set for channels 0, 1, and 2.
rev. 2.00, 09/04, page 162 of 720 10.3.3 timer i/o cont rol register (tior) the tior registers are 8-bit readable/writable re gisters that control the tgr registers. the mtu has eight tior registers, two each for channels 0, 3, and 4, and one each for channels 1 and 2. care is required as tior is affected by the tm dr setting. the initial output specified by tior is valid when the counter is stopped (the cst bit in tstr is cleared to 0). note also that, in pwm mode 2, the output at the point at which the counter is cleared to 0 is specified. when tgrc or tgrd is designated for buffer operation, this setting is invalid and the register operates as a buffer register. ? tiorh_0, tior_1, tior_2, tiorh_3, tiorh_4 bit bit name initial value r/w description 7 6 5 4 iob3 iob2 iob1 iob0 0 0 0 0 r/w r/w r/w r/w i/o control b0 to b3 specify the function of tgrb. see the following tables. tiorh_0: table 10.10 tior_1: table 10.14 tior_2: table 10.16 tiorh_3: table 10.18 tiorh_4: table 10.22 3 2 1 0 ioa3 ioa2 ioa1 ioa0 0 0 0 0 r/w r/w r/w r/w i/o control a0 to a3 specify the function of tgra. see the following tables. tiorh_0: table 10.11 tior_1: table 10.15 tior_2: table 10.17 tiorh_3: table 10.19 tiorh_4: table 10.23
rev. 2.00, 09/04, page 163 of 720 ? tiorl_0, tiorl_3, tiorl_4 bit bit name initial value r/w description 7 6 5 4 iod3 iod2 iod1 iod0 0 0 0 0 r/w r/w r/w r/w i/o control d0 to d3 specify the function of tgrd. when tgrd is used as the buffer register of tgrb, this setting is disabled, and input capture/output compare does not occur. see the following tables. tiorl_0: table 10.12 tiorl_3: table 10.20 tiorl_4: table 10.24 3 2 1 0 ioc3 ioc2 ioc1 ioc0 0 0 0 0 r/w r/w r/w r/w i/o control c0 to c3 specify the function of tgrc. when tgrc is used as the buffer register of tgra, this setting is disabled, and input capture/output compare does not occur. see the following tables. tiorl_0: table 10.13 tiorl_3: table 10.21 tiorl_4: table 10.25
rev. 2.00, 09/04, page 164 of 720 table 10.10 tiorh_0 (channel 0) description bit 7 iob3 bit 6 iob2 bit 5 iob1 bit 4 iob0 tgrb_0 function tioc0b pin function 0 output hold * 0 1 initial output is 0 0 output at compare match 0 initial output is 0 1 output at compare match 0 1 1 initial output is 0 toggle output at compare match 0 output hold 0 1 initial output is 1 0 output at compare match 0 initial output is 1 1 output at compare match 0 1 1 1 output compare register initial output is 1 toggle output at compare match 0 input capture at rising edge 0 1 input capture at falling edge 0 1 x input capture at both edges 1 1 x x input capture register capture input source is channel 1/count clock input capture at tcnt _1 count- up/count-down [legend] x: don?t care note: * the low level output is retained until tior contents is specified after a power-on reset.
rev. 2.00, 09/04, page 165 of 720 table 10.11 tiorh_0 (channel 0) description bit 3 ioa3 bit 2 ioa2 bit 1 ioa1 bit 0 ioa0 tgra_0 function tioc0a pin function 0 0 0 0 output hold * 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 0 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture at both edges 1 x x input capture register capture input source is channel 1/count clock input capture at tcnt _1 count-up/count-down [legend] x: don?t care note: * the low level output is retained until tior contents is specified after a power-on reset.
rev. 2.00, 09/04, page 166 of 720 table 10.12 tiorl_0 (channel 0) description bit 7 iod3 bit 6 iod2 bit 5 iod1 bit 4 iod0 tgrd_0 function tioc0d pin function 0 0 0 0 output hold * 1 1 initial output is 0 0 output at compare match 1 0 output compare register initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 0 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture at both edges 1 x x input capture register * 2 capture input source is channel 1/count clock input capture at tcnt _1 count-up/count-down [legend] x: don?t care notes: 1. the low level output is retained until tior contents is specified after a power-on reset. 2. when the bfb bit in tmdr_0 is set to 1 and tgrd_0 is used as a buffer register, this setting is invalid and input captur e/output compare is not generated.
rev. 2.00, 09/04, page 167 of 720 table 10.13 tiorl_0 (channel 0) description bit 3 ioc3 bit 2 ioc2 bit 1 ioc1 bit 0 ioc0 tgrc_0 function tioc0c pin function 0 0 0 0 output hold * 1 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 0 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture at both edges 1 x x input capture register * 2 capture input source is channel 1/count clock input capture at tcnt _1 count-up/count-down [legend] x: don?t care notes: 1. the low level output is retained until tior contents is specified after a power-on reset. 2. when the bfa bit in tmdr_0 is set to 1 and tgrc_0 is used as a buffer register, this setting is invalid and input captur e/output compare is not generated.
rev. 2.00, 09/04, page 168 of 720 table 10.14 tior_1 (channel 1) description bit 7 iob3 bit 6 iob2 bit 5 iob1 bit 4 iob0 tgrb_1 function tioc1b pin function 0 0 0 0 output hold * 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 0 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture at both edges 1 x x input capture register input capture at generat ion of tgrc_0 compare match/input capture [legend] x: don?t care note: * the low level output is retained until tior contents is specified after a power-on reset.
rev. 2.00, 09/04, page 169 of 720 table 10.15 tior_1 (channel 1) description bit 3 ioa3 bit 2 ioa2 bit 1 ioa1 bit 0 ioa0 tgra_1 function tioc1a pin function 0 0 0 0 output hold * 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 0 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture at both edges 1 x x input capture register input capture at generati on of channel 0/tgra_0 compare match/input capture [legend] x: don?t care note: * the low level output is retained until tior contents is specified after a power-on reset.
rev. 2.00, 09/04, page 170 of 720 table 10.16 tior_2 (channel 2) description bit 7 iob3 bit 6 iob2 bit 5 iob1 bit 4 iob0 tgrb_2 function tioc2b pin function 0 0 0 0 output hold * 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture register input capture at both edges [legend] x: don?t care note: * the low level output is retained until tior contents is specified after a power-on reset.
rev. 2.00, 09/04, page 171 of 720 table 10.17 tior_2 (channel 2) description bit 3 ioa3 bit 2 ioa2 bit 1 ioa1 bit 0 ioa0 tgra_2 function tioc2a pin function 0 0 0 0 output hold * 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture register input capture at both edges [legend] x: don?t care note: * the low level output is retained until tior contents is specified after a power-on reset.
rev. 2.00, 09/04, page 172 of 720 table 10.18 tiorh_3 (channel 3) description bit 7 iob3 bit 6 iob2 bit 5 iob1 bit 4 iob0 tgrb_3 function tioc3b pin function 0 0 0 0 output hold * 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture register input capture at both edges [legend] x: don?t care note: * the low level output is retained until tior contents is specified after a power-on reset.
rev. 2.00, 09/04, page 173 of 720 table 10.19 tiorh_3 (channel 3) description bit 3 ioa3 bit 2 ioa2 bit 1 ioa1 bit 0 ioa0 tgra_3 function tioc3a pin function 0 0 0 0 output hold * 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture register input capture at both edges [legend] x: don?t care note: * the low level output is retained until tior contents is specified after a power-on reset.
rev. 2.00, 09/04, page 174 of 720 table 10.20 tiorl_3 (channel 3) description bit 7 iod3 bit 6 iod2 bit 5 iod1 bit 4 iod0 tgrd_3 function tioc3d pin function 0 0 0 0 output hold * 1 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture register * 2 input capture at both edges [legend] x: don?t care notes: 1. the low level output is retained until tior contents is specified after a power-on reset. 2. when the bfb bit in tmdr_3 is set to 1 and tgrd_3 is used as a buffer register, this setting is invalid and input captur e/output compare is not generated.
rev. 2.00, 09/04, page 175 of 720 table 10.21 tiorl_3 (channel 3) description bit 3 ioc3 bit 2 ioc2 bit 1 ioc1 bit 0 ioc0 tgrc_3 function tioc3c pin function 0 0 0 0 output hold * 1 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture register * 2 input capture at both edges [legend] x: don?t care notes: 1. the low level output is retained until tior contents is specified after a power-on reset. 2. when the bfa bit in tmdr_3 is set to 1 and tgrc_3 is used as a buffer register, this setting is invalid and input captur e/output compare is not generated.
rev. 2.00, 09/04, page 176 of 720 table 10.22 tiorh_4 (channel 4) description bit 7 iob3 bit 6 iob2 bit 5 iob1 bit 4 iob0 tgrb_4 function tioc4b pin function 0 0 0 0 output hold * 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture register input capture at both edges [legend] x: don?t care note: * the low level output is retained until tior contents is specified after a power-on reset.
rev. 2.00, 09/04, page 177 of 720 table 10.23 tiorh_4 (channel 4) description bit 3 ioa3 bit 2 ioa2 bit 1 ioa1 bit 0 ioa0 tgra_4 function tioc4a pin function 0 0 0 0 output hold * 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture register input capture at both edges [legend] x: don?t care note: * the low level output is retained until tior contents is specified after a power-on reset.
rev. 2.00, 09/04, page 178 of 720 table 10.24 tiorl_4 (channel 4) description bit 7 iod3 bit 6 iod2 bit 5 iod1 bit 4 iod0 tgrd_4 function tioc4d pin function 0 0 0 0 output hold * 1 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture register * 2 input capture at both edges [legend] x: don?t care notes: 1. the low level output is retained until tior contents is specified after a power-on reset. 2. when the bfb bit in tmdr_4 is set to 1 and tgrc_4 is used as a buffer register, this setting is invalid and input captur e/output compare is not generated.
rev. 2.00, 09/04, page 179 of 720 table 10.25 tiorl_4 (channel 4) description bit 3 ioc3 bit 2 ioc2 bit 1 ioc1 bit 0 ioc0 tgrc_4 function tioc4c pin function 0 0 0 0 output hold * 1 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture register * 2 input capture at both edges [legend] x: don?t care notes: 1. the low level output is retained until tior contents is specified after a power-on reset. 2. when the bfa bit in tmdr_4 is set to 1 and tgrc_4 is used as a buffer register, this setting is invalid and input captur e/output compare is not generated.
rev. 2.00, 09/04, page 180 of 720 10.3.4 timer interrupt enable register (tier) the tier registers are 8-bit read able/writable registers that control enabling or disabling of interrupt requests for each channel. the mtu has five tier registers, one for each channel. bit bit name initial value r/w description 7 ttge 0 r/w a/d conversion start request enable enables or disables generat ion of a/d conversion start requests by tgra input capture/compare match. 0: a/d conversion start request generation disabled 1: a/d conversion start request generation enabled 6 ? 1 r reserved this bit is always read as 1, and should only be written with 1. 5 tcieu 0 r/w underflow interrupt enable enables or disables interrupt requests (tciu) by the tcfu flag when the tcfu flag in tsr is set to 1 in channels 1 and 2. in channels 0, 3, and 4, bit 5 is reserved. it is always read as 0, and should only be written with 0. 0: interrupt requests (tciu) by tcfu disabled 1: interrupt requests (tciu) by tcfu enabled 4 tciev 0 r/w overflow interrupt enable enables or disables interrupt requests (tciv) by the tcfv flag when the tcfv flag in tsr is set to 1. 0: interrupt requests (tciv) by tcfv disabled 1: interrupt requests (tciv) by tcfv enabled 3 tgied 0 r/w tgr interrupt enable d enables or disables interrupt requests (tgid) by the tgfd bit when the tgfd bit in tsr is set to 1 in channels 0, 3, and 4. in channels 1 and 2, bit 3 is reserved. it is always read as 0, and should only be written with 0. 0: interrupt requests (tgid ) by tgfd bit disabled 1: interrupt requests (tgid) by tgfd bit enabled
rev. 2.00, 09/04, page 181 of 720 bit bit name initial value r/w description 2 tgiec 0 r/w tgr interrupt enable c enables or disables interrupt requests (tgic) by the tgfc bit when the tgfc bit in tsr is set to 1 in channels 0, 3, and 4. in channels 1 and 2, bit 2 is reserved. it is always read as 0, and should only be written with 0. 0: interrupt requests (tgic ) by tgfc bit disabled 1: interrupt requests (tgic) by tgfc bit enabled 1 tgieb 0 r/w tgr interrupt enable b enables or disables interrupt requests (tgib) by the tgfb bit when the tgfb bit in tsr is set to 1. 0: interrupt requests (tgib) by tgfb bit disabled 1: interrupt requests (tgib) by tgfb bit enabled 0 tgiea 0 r/w tgr interrupt enable a enables or disables interrupt requests (tgia) by the tgfa bit when the tgfa bit in tsr is set to 1. 0: interrupt requests (tgia) by tgfa bit disabled 1: interrupt requests (tgia) by tgfa bit enabled
rev. 2.00, 09/04, page 182 of 720 10.3.5 timer status register (tsr) the tsr registers are 8-bit readable/writable regist ers that indicate the status of each channel. the mtu has five tsr registers, one for each channel. bit bit name initial value r/w description 7 tcfd 1 r count direction flag status flag that shows the dire ction in which tcnt counts in channels 1, 2, 3, and 4. in channel 0, bit 7 is reserved. it is always read as 1, and should only be written with 1. 0: tcnt counts down 1: tcnt counts up 6 ? 1 r reserved this bit is always read as 1, and should only be written with 1. 5 tcfu 0 r/(w) underflow flag status flag that indicates that tcnt underflow has occurred when channels 1 and 2 are set to phase counting mode. only 0 can be written, for flag clearing. in channels 0, 3, and 4, bit 5 is reserved. it is always read as 0, and should only be written with 0. [setting condition] ? when the tcnt value underflows (changes from h'0000 to h'ffff) [clearing condition] ? when 0 is written to tcfu after reading tcfu = 1 4 tcfv 0 r/(w) overflow flag status flag that indicates that tcnt overflow has occurred. only 0 can be written, for flag clearing. [setting condition] ? when the tcnt value overflows (changes from h'ffff to h?0000) ? in channel 4, when tcnt-4 is underflowed (h'0001 h'0000) in complementary pwm mode. [clearing condition] ? when 0 is written to tcfv after reading tcfv = 1 ? in channel 4, when dtc is activated by the tciv interrupt and the disel bit in dtmr of dtc is 0.
rev. 2.00, 09/04, page 183 of 720 bit bit name initial value r/w description 3 tgfd 0 r/(w) input capt ure/output compare flag d status flag that indicates the occurrence of tgrd input capture or compare match in channels 0, 3, and 4. only 0 can be written, for flag clearing. in channels 1 and 2, bit 3 is reserved. it is always read as 0, and should only be written with 0. [setting conditions] ? when tcnt = tgrd and tgrd is functioning as output compare register ? when tcnt value is transferred to tgrd by input capture signal and tgrd is func tioning as input capture register [clearing conditions] ? when dtc is activated by tgid interrupt and the disel bit of dtmr in dtc is 0 ? when 0 is written to tgfd after reading tgfd = 1 2 tgfc 0 r/(w) input capt ure/output compare flag c status flag that indicates the occurrence of tgrc input capture or compare match in channels 0, 3, and 4. only 0 can be written, for flag clearing. in channels 1 and 2, bit 2 is reserved. it is always read as 0, and should only be written with 0. [setting conditions] ? when tcnt = tgrc and tgrc is functioning as output compare register ? when tcnt value is transferred to tgrc by input capture signal and tgrc is func tioning as input capture register [clearing conditions] ? when dtc is activated by tgic interrupt and the disel bit of dtmr in dtc is 0 ? when 0 is written to tgfc after reading tgfc = 1
rev. 2.00, 09/04, page 184 of 720 bit bit name initial value r/w description 1 tgfb 0 r/(w) input capt ure/output compare flag b status flag that indicates t he occurrence of tgrb input capture or compare match. only 0 can be written, for flag clearing. [setting conditions] ? when tcnt = tgrb and tgrb is functioning as output compare register ? when tcnt value is transferred to tgrb by input capture signal and tgrb is f unctioning as input capture register [clearing conditions] ? when dtc is activated by tgib interrupt and the disel bit of dtmr in dtc is 0 ? when 0 is written to tgfb after reading tgfb = 1 0 tgfa 0 r/(w) input capt ure/output compare flag a status flag that indicates t he occurrence of tgra input capture or compare match. only 0 can be written, for flag clearing. [setting conditions] ? when tcnt = tgra and tgra is functioning as output compare register ? when tcnt value is transferred to tgra by input capture signal and tgra is f unctioning as input capture register [clearing conditions] ? when dtc is activated by tgia interrupt and the disel bit of dtmr in dtc is 0 ? when 0 is written to tgfa after reading tgfa = 1
rev. 2.00, 09/04, page 185 of 720 10.3.6 timer counter (tcnt) the tcnt registers are 16-bit r eadable/writable counters. the mt u has five tcnt counters, one for each channel. the tcnt counters are initialized to h'0000 by a reset and in hardware standby mode. the tcnt counters cannot be accessed in 8-bit un its; they must always be accessed as a 16-bit unit. 10.3.7 timer general register (tgr) the tgr registers are dual function 16-bit readable/writable registers, functioning as either output compare or input capture register s. the mtu has 16 tgr registers, four each for channels 0, 3, and 4 and two each for channels 1 and 2. tgrc and tgrd for channels 0, 3, and 4 can also be designated for operation as buffer registers. th e tgr registers cannot be accessed in 8-bit units; they must always be accessed as a 16-bit unit. tgr buffer register combinations are tgra ? tgrc and tgrb ? tgrd. the initial value of tgr is h'ffff.
rev. 2.00, 09/04, page 186 of 720 10.3.8 timer start register (tstr) tstr is an 8-bit readable/writable register that selects operation/stoppage for channels 0 to 4. when setting the operating mode in tmdr or setting the count clock in tcr, first stop the tcnt counter. bit bit name initial value r/w description 7 6 cst4 cst3 0 0 r/w r/w counter start 4 and 3 these bits select operat ion or stoppage for tcnt. if 0 is written to the cst bit during operation with the tioc pin designated for output, the counter stops but the tioc pin output compare output level is retained. if tior is written to when the cst bit is cleared to 0, the pin output level will be changed to the set initial output value. 0: tcnt_4 and tcnt_3 co unt operation is stopped 1: tcnt_4 and tcnt_3 per forms count operation 5 to 3 ? all 0 r reserved these bits are always read as 0. only 0 should be written to these bits. 2 1 0 cst2 cst1 cst0 0 0 0 r/w r/w r/w counter start 2 to 0 these bits select operat ion or stoppage for tcnt. if 0 is written to the cst bit during operation with the tioc pin designated for output, the counter stops but the tioc pin output compare output level is retained. if tior is written to when the cst bit is cleared to 0, the pin output level will be changed to the set initial output value. 0: tcnt_2 to tcnt_0 coun t operation is stopped 1: tcnt_2 to tcnt_0 per forms count operation
rev. 2.00, 09/04, page 187 of 720 10.3.9 timer synchro register (tsyr) tsyr is an 8-bit readable/writable register th at selects independent operation or synchronous operation for the channel 0 to 4 tcnt counters. a channel performs synchronous operation when the corresponding bit in tsyr is set to 1. bit bit name initial value r/w description 7 6 sync4 sync3 0 0 r/w r/w timer synchro 4 and 3 these bits are used to select whether operation is independent of or synchronized with other channels. when synchronous operation is selected, the tcnt synchronous presetting of multiple channels, and synchronous clearing by counter clearing on another channel, are possible. to set synchronous operation, the sync bits for at least two channels must be set to 1. to set synchronous clearing, in addition to the sync bit, the tcnt clearing source must also be set by means of bits cclr0 to cclr2 in tcr. 0: tcnt_4 and tcnt_3 oper ate independently (tcnt presetting/clearing is unrelated to other channels) 1: tcnt_4 and tcnt_3 performs synchronous operation tcnt synchronous presetting/synchronous clearing is possible 5 to 3 ? all 0 r reserved these bits are always read as 0. only 0 should be written to these bits. 2 1 0 sync2 sync1 sync0 0 0 0 r/w r/w r/w timer synchro 2 to 0 these bits are used to select whether operation is independent of or synchronized with other channels. when synchronous operation is selected, the tcnt synchronous presetting of multiple channels, and synchronous clearing by counter clearing on another channel, are possible. to set synchronous operation, the sync bits for at least two channels must be set to 1. to set synchronous clearing, in addition to the sync bit, the tcnt clearing source must also be set by means of bits cclr0 to cclr2 in tcr. 0: tcnt_2 to tcnt_0 operat es independently (tcnt presetting /clearing is unrelated to other channels) 1: tcnt_2 to tcnt_0 perfo rms synchronous operation tcnt synchronous presetting/synchronous clearing is possible
rev. 2.00, 09/04, page 188 of 720 10.3.10 timer output master enable register (toer) toer is an 8-bit readable/writable register that enables/disables output settings for output pins tioc4d, tioc4c, tioc3d, tioc4b, tioc4a, and tioc3b. these pins do not output correctly if the toer bits have not been set. set toer of ch3 and ch4 prior to setting tior of ch3 and ch4. bit bit name initial value r/w description 7, 6 ? all 1 r reserved these bits are always read as 1. only 1 should be written to these bits. 5 oe4d 0 r/w master enable tioc4d this bit enables/disables the tioc4d pin mtu output. 0: mtu output is disabled 1: mtu output is enabled 4 oe4c 0 r/w master enable tioc4c this bit enables/disables the tioc4c pin mtu output. 0: mtu output is disabled 1: mtu output is enabled 3 oe3d 0 r/w master enable tioc3d this bit enables/disables the tioc3d pin mtu output. 0: mtu output is disabled 1: mtu output is enabled 2 oe4b 0 r/w master enable tioc4b this bit enables/disables the tioc4b pin mtu output. 0: mtu output is disabled 1: mtu output is enabled 1 oe4a 0 r/w master enable tioc4a this bit enables/disables the tioc4a pin mtu output. 0: mtu output is disabled 1: mtu output is enabled 0 oe3b 0 r/w master enable tioc3b this bit enables/disables the tioc3b pin mtu output. 0: mtu output is disabled 1: mtu output is enabled
rev. 2.00, 09/04, page 189 of 720 10.3.11 timer output co ntrol register (tocr) tocr is an 8-bit readable/writable register that enables/disables pwm synchronized toggle output in complementary pwm mode/reset synchronized pwm mode, and controls output level inversion of pwm output. bit bit name initial value r/w description 7 ? 0 r reserved this bit is always read as 0. only 0 should be written to this bit. 6 psye 0 r/w pwm synchronous output enable this bit selects the enable /disable of toggle output synchronized with the pwm period. 0: toggle output is disabled 1: toggle output is enabled 5 to 2 ? all 0 r reserved these bits are always read as 0. only 0 should be written to this bit. 1 olsn 0 r/w output level select n this bit selects the reverse phase output level in reset- synchronized pwm mode/complementary pwm mode. see table 10.26 0 olsp 0 r/w output level select p this bit selects the positive phase output level in reset- synchronized pwm mode/complementary pwm mode. see table 10.27 table 10.26 output level select function bit 1 function compare match output olsn initial output active level increment count decrement count 0 high level low level high level low level 1 low level high level low level high level note: the reverse phase waveform initial output val ue changes to active level after elapse of the dead time after count start.
rev. 2.00, 09/04, page 190 of 720 table 10.27 output level select function bit 1 function compare match output olsp initial output active level increment count decrement count 0 high level low level low level high level 1 low level high level high level low level figure 10.2 shows an example of complementary pwm mode output (1 phase) when olsn = 1, olsp = 1. tcnt_3, and tcnt_4 values tgra_3 tgra_4 tddr h'0000 time tcnt_4 tcnt_3 positive phase output reverse phase output active level compare match output (up count) initial output initial output active level compare match output (down count) compare match output (down count) compare match output (up count) active level figure 10.2 complementary pwm mode output level example
rev. 2.00, 09/04, page 191 of 720 10.3.12 timer gate cont rol register (tgcr) tgcr is an 8-bit readable/writable register that controls the waveform output necessary for brushless dc motor control in reset-synchronized pwm mode/complementary pwm mode. these register settings are ineffective for anyt hing other than complementary pwm mode/reset- synchronized pwm mode. bit bit name initial value r/w description 7 ? 0 r reserved this bit is always read as 1. only 1 should be written to this bit. 6 bdc 0 r/w brushless dc motor this bit selects whether to make the functions of this register (tgcr) effective or ineffective. 0: ordinary output 1: functions of this register are made effective 5 n 0 r/w reverse phase output (n) control this bit selects whether the level output or the reset- synchronized pwm/complementary pwm output while the reverse pins (tioc3d, tioc4c, and tioc4d) are on- output. 0: level output 1: reset synchronized pwm/complementary pwm output 4 p 0 r/w positive phase output (p) control this bit selects whether the level output or the reset- synchronized pwm/complementary pwm output while the positive pin (tioc3b, tioc4a, and tioc4b) are on-output. 0: level output 1: reset synchronized pwm/complementary pwm output 3 fb 0 r/w external feedback signal enable this bit selects whether the s witching of the output of the positive/reverse phase is carried out automatically with the mtu/channel 0 tgra, tgrb, tgrc input capture signals or by writing 0 or 1 to bits 2 to 0 in tgcr. 0: output switching is carried out by external input (input sources are channel 0 tgra, tgrb, tgrc input capture signal) 1: output switching is carried out by software (tgcr's uf, vf, wf settings).
rev. 2.00, 09/04, page 192 of 720 bit bit name initial value r/w description 2 1 0 wf vf uf 0 0 0 r/w r/w r/w output phase switch 2 to 0 these bits set the positive phase/negative phase output phase on or off state. the setting of these bits is valid only when the fb bit in this register is set to 1. in this case, the setting of bits 2 to 0 is a subs titute for external input. see table 10.28. table 10.28 output level select function function bit 2 bit 1 bit 0 tioc3b tioc4a tioc4b tioc3d tioc4c tioc4d wf vf uf u phase v phase w phase u phase v phase w phase 0 0 0 off off off off off off 1 on off off off off on 1 0 off on off on off off 1 off on off off off on 1 0 0 off off on off on off 1 on off off off on off 1 0 off off on on off off 1 off off off off off off 10.3.13 timer subcounter (tcnts) tcnts is a 16-bit read-only counter that is used only in complementary pwm mode. the initial value is h'0000. note: accessing the tcnts in 8-bit units is prohibited. always access in 16-bit units. 10.3.14 timer dead time data register (tddr) tddr is a 16-bit register, used only in complementary pwm mode, that specifies the tcnt_3 and tcnt_4 counter offset values. in complementary pwm mode, when the tcnt_3 and tcnt_4 counters are cleared and then restarted, the tddr register value is loaded into the tcnt_3 counter and the count operation starts. the initial value is h'ffff. note: accessing the tddr in 8-bit units is prohibited. always access in 16-bit units.
rev. 2.00, 09/04, page 193 of 720 10.3.15 timer period data register (tcdr) tcdr is a 16-bit register used only in complementary pwm mode. set half the pwm carrier sync value as the tcdr register value. this register is cons tantly compared with the tcnts counter in complementary pwm mode, and when a match occurs, the tcnts counter switches direction (decrement to incremen t). the initial value is h'ffff. note: accessing the tcdr in 8-bit units is prohibited. always access in 16-bit units. 10.3.16 timer period buffer register (tcbr) the timer period buffer register (tcbr) is a 16-bit register used only in complementary pwm mode. it functions as a buffer register for th e tcdr register. the tcbr register values are transferred to the tcdr register with the tran sfer timing set in the tmdr register. the initial value is h'ffff. note: accessing the tcbr in 8- bit units is prohibited. al ways access in 16-bit units. 10.3.17 bus master interface the timer counters (tcnt), general registers (tgr), timer subcounter (tcnts), timer period buffer register (tcbr), and timer dead time data re gister (tddr), and timer period data register (tcdr) are 16-bit registers. a 16-bit data bus to the bus master enables 16-b it read/writes. 8-bit read/write is not possible. always access in 16-bit units. all registers other than the above registers are 8-b it registers. these are connected to the cpu by a 16-bit data bus, so 16-bit read/writes and 8-bit read/writes are both possible.
rev. 2.00, 09/04, page 194 of 720 10.4 operation 10.4.1 basic functions each channel has a tcnt and tgr register. tcnt performs up-counting, an d is also capable of free-running operation, synchronous counting, and external event counting. each tgr can be used as an input captur e register or output compare register. always set the mtu external pins function using the pin function controller (pfc). counter operation: when one of bits cst0 to cst4 is set to 1 in tstr, the tcnt counter for the corresponding channel begins counting. tcnt can operate as a free-running counter, periodic counter, for example. 1. example of count operation setting procedure figure 10.3 shows an example of the count operation setting procedure. operation selection select counter clock periodic counter select counter clearing source select output compare register set period free-running counter start count operation start count operation [1] [2] [3] [4] [5] [5] [1] select the counter clock with bits tpsc2 to tpsc0 in tcr. at the same time, select the input clock edge with bits ckeg1 and ckeg0 in tcr. [2] for periodic counter operation, select the tgr to be used as the tcnt clearing source with bits cclr2 to cclr0 in tcr. [3] designate the tgr selected in [2] as an output compare register by means of tior. [4] set the periodic counter cycle in the tgr selected in [2]. [5] set the cst bit in tstr to 1 to start the counter operation. figure 10.3 example of coun ter operation setting procedure
rev. 2.00, 09/04, page 195 of 720 2. free-running count operation and periodic count operation immediately after a reset, the mtu?s tcnt counters are all designated as free-running counters. when the relevant bit in tstr is se t to 1 the corresponding tcnt counter starts up- count operation as a free-running counter. when tcnt overflows (from h'ffff to h'0000), the tcfv bit in tsr is set to 1. if the value of the corresponding tciev bit in tier is 1 at this point, the mtu requests an interrupt. afte r overflow, tcnt starts counting up again from h'0000. figure 10.4 illustrates free-running counter operation. tcnt value h'ffff h'0000 cst bit tcfv time figure 10.4 free-running counter operation when compare match is selected as the tcnt clearing source, the tcnt counter for the relevant channel performs periodic count operation. the tgr register for setting the period is designated as an output compar e register, and counter clearing by compare match is selected by means of bits cclr0 to cclr2 in tcr. after the settings have been made, tcnt starts up-count operation as a periodic counter when the corresponding bit in tstr is set to 1. when the count value matches the value in tgr, the tgf bit in tsr is set to 1 and tcnt is cleared to h'0000. if the value of the corresponding tgie bit in tier is 1 at this point, the tpu requests an interrupt. after a compare match, tcnt starts counting up again from h'0000. figure 10.5 illustrates periodic counter operation.
rev. 2.00, 09/04, page 196 of 720 tcnt value tgr h'0000 cst bit tgf time counter cleared by tgr compare match flag cleared by software or dtc activation figure 10.5 periodic counter operation waveform output by compare match: the mtu can perform 0, 1, or toggle output from the corresponding output pin using compare match. 1. example of setting procedure for waveform output by compare match figure 10.6 shows an example of the setting procedure for waveform output by compare match. output selection select waveform output mode set output timing start count operation [1] [2] [3] [1] select initial value 0 output or 1 output, and compare match output value 0 output, 1 output, or toggle output, by means of tior. the set initial value is output at the tioc pin until the first compare match occurs. [2] set the timing for compare match generation in tgr. [3] set the cst bit in tstr to 1 to start the count operation. figure 10.6 example of setting procedu re for waveform output by compare match
rev. 2.00, 09/04, page 197 of 720 2. examples of waveform output operation figure 10.7 shows an example of 0 output/1 output. in this example tcnt has been designated as a free-running counter, and settings have been made such that 1 is output by compare match a, and 0 is output by compare match b. when the set level and the pin level coincide, the pin level does not change. tcnt value h'ffff h'0000 tioca tiocb time tgra tgrb no change no change no change no change 1 output 0 output figure 10.7 example of 0 output/1 output operation figure 10.8 shows an example of toggle output. in this example, tcnt has b een designated as a periodic co unter (with counter clearing on compare match b), and settings have been made such that the output is toggled by both compare match a and compare match b. tcnt value h'ffff h'0000 tiocb tioca time tgrb tgra toggle output toggle output counter cleared by tgrb compare match figure 10.8 example of toggle output operation
rev. 2.00, 09/04, page 198 of 720 input capture function: the tcnt value can be transferred to tgr on detection of the tioc pin input edge. rising edge, falling edge, or both edges can be selected as the detected edge. for channels 0 and 1, it is also possible to specify another channel's co unter input clock or compare match signal as the input capture source. note: when another channel's counter input clock is used as the input capture input for channels 0 and 1, /1 should not be selected as the counter input clock used for input capture input. input capture will not be generated if /1 is selected. 1. example of input capture operation setting procedure figure 10.9 shows an example of the in put capture operation setting procedure. input selection select input capture input start count [1] [2] [1] designate tgr as an input capture register by means of tior, and select rising edge, falling edge, or both edges as the input capture source and input signal edge. [2] set the cst bit in tstr to 1 to start the count operation. figure 10.9 example of input ca pture operation setting procedure 2. example of input capture operation figure 10.10 shows an example of input capture operation. in this example both rising and falling edges have been selected as the tioca pin input capture input edge, the falling edge has been se lected as the tiocb pi n input capture input edge, and counter clearing by tgrb input capture has been designated for tcnt.
rev. 2.00, 09/04, page 199 of 720 tcnt value h'0180 h'0000 tioca tgra h'0010 h'0005 counter cleared by tiocb input (falling edge) h'0160 h'0005 h'0160 h'0010 tgrb h'0180 tiocb time figure 10.10 example of input capture operation
rev. 2.00, 09/04, page 200 of 720 10.4.2 synchronous operation in synchronous operation, the values in a number of tcnt counters can be rewritten simultaneously (synchronous presetting). also, a number of tcnt counters can be cleared simultaneously by making the appropriate setting in tcr (synchronous clearing). synchronous operation enables tgr to be incr emented with respect to a single time base. channels 0 to 4 can all be designated for synchronous operation. example of synchronous operation setting procedure: figure 10.11 shows an example of the synchronous operatio n setting procedure. no yes set synchronous operation clearing source generation channel? select counter clearing source start count set synchronous counter clearing start count [1] [3] [5] [4] [5] [2] synchronous operation selection [1] set to 1 the sync bits in tsyr corresponding to the channels to be designated for synchronous operation. [2] when the tcnt counter of any of the channels designated for synchronous operation is written to, the same value is simultaneously written to the other tcnt counters. [3] use bits cclr2 to cclr0 in tcr to specify tcnt clearing by input capture/output compare, etc. [4] use bits cclr2 to cclr0 in tcr to designate synchronous clearing for the counter clearing source. [5] set to 1 the cst bits in tstr for the relevant channels, to start the count operation. set tcnt synchronous presetting synchronous clearing figure 10.11 example of synchronous operation setting procedure
rev. 2.00, 09/04, page 201 of 720 example of synchronous operation: figure 10.12 shows an example of synchronous operation. in this example, synchronous operation and pwm mode 1 have been designated for channels 0 to 2, tgrb_0 compare match has been set as the channel 0 counter clearing source, and synchronous clearing has been set for the channel 1 and 2 counter clearing source. three-phase pwm waveforms are output from pins tioc0a, tioc1a, and tioc2a. at this time, synchronous presetting, and synchron ous clearing by tgrb_0 compare match, are performed for channel 0 to 2 tcnt counters, and the data set in tgrb_0 is used as the pwm cycle. for details of pwm modes, see section 10.4.5, pwm modes. tcnt0 to tcnt2 values h'0000 tioca_0 tioca_1 tgrb_0 synchronous clearing by tgrb_0 compare match tgra_2 tgra_1 tgrb_2 tgra_0 tgrb_1 tioca_2 time figure 10.12 example of synchronous operation
rev. 2.00, 09/04, page 202 of 720 10.4.3 buffer operation buffer operation, provided for channels 0, 3, and 4, enables tgrc and tgrd to be used as buffer registers. buffer operation differs depending on whether tgr has been designated as an input capture register or as a compare match register. table 10.29 shows the register combinations used in buffer operation. table 10.29 register combinat ions in buffer operation channel timer general re gister buffer register 0 tgra_0 tgrc_0 tgrb_0 tgrd_0 3 tgra_3 tgrc_3 tgrb_3 tgrd_3 4 tgra_4 tgrc_4 tgrb_4 tgrd_4 ? when tgr is an output compare register when a compare match occurs, the value in the bu ffer register for the corresponding channel is transferred to the timer general register. this operation is illustrated in figure 10.13. buffer register timer general register tcnt comparator compare match signal figure 10.13 compare match buffer operation
rev. 2.00, 09/04, page 203 of 720 ? when tgr is an inpu t capture register when input capture occurs, the value in tcnt is transferred to tgr and the value previously held in the timer general register is transferred to the buffer register. this operation is illustrated in figure 10.14. buffer register timer general register tcnt input capture signal figure 10.14 input capture buffer operation example of buffer operation setting procedure: figure 10.15 shows an example of the buffer operation setting procedure. buffer operation select tgr function set buffer operation start count [1] [2] [3] [1] designate tgr as an input capture register or output compare register by means of tior. [2] designate tgr for buffer operation with bits bfa and bfb in tmdr. [3] set the cst bit in tstr to 1 start the count operation. figure 10.15 example of buffe r operation setting procedure
rev. 2.00, 09/04, page 204 of 720 examples of buffer operation: 1. when tgr is an output compare register figure 10.16 shows an operation example in which pwm mode 1 has been designated for channel 0, and buffer operation has been designated for tgra and tgrc. the settings used in this example are tcnt clearing by compar e match b, 1 output at compare match a, and 0 output at compare match b. as buffer operation has been set, when comp are match a occurs the output changes and the value in buffer register tgrc is simultaneously transferred to timer general register tgra. this operation is repeated each time that compare match a occurs. for details of pwm modes, see section 10.4.5, pwm modes. tcnt value tgrb_0 h'0000 tgrc_0 tgra_0 h'0200 h'0520 tioca h'0200 h'0450 h'0520 h'0450 tgra_0 h'0450 h'0200 transfer time figure 10.16 example of buffer operation (1)
rev. 2.00, 09/04, page 205 of 720 2. when tgr is an i nput capture register figure 10.17 shows an operation example in which tgra has been designated as an input capture register, and buffer operation has been designated for tgra and tgrc. counter clearing by tgra input capture has been set for tcnt, and both rising and falling edges have been selected as the tioca pin input capture input edge. as buffer operation has been set, when the tcnt value is stored in tgra upon the occurrence of input capture a, the value previously stored in tgra is simultaneously transferred to tgrc. tcnt value h'09fb h'0000 tgrc time h'0532 tioca tgra h'0f07 h'0532 h'0f07 h'0532 h'0f07 h'09fb figure 10.17 example of buffer operation (2)
rev. 2.00, 09/04, page 206 of 720 10.4.4 cascaded operation in cascaded operation, two 16-bit counters for different channels are used together as a 32-bit counter. this function works by counting the channel 1 counter clock upon overflow/underflow of tcnt_2 as set in bits tpsc0 to tpsc2 in tcr. underflow occurs only when the lower 16-bit tcnt is in phase-counting mode. table 10.30 shows the register combinations used in cascaded operation. note: when phase counting mode is set for channel 1 or 4, the counter clock setting is invalid and the counters operates independently in phase counting mode. table 10.30 cascaded combinations combination upper 16 bits lower 16 bits channels 1 and 2 tcnt_1 tcnt_2 example of cascaded oper ation setting procedure: figure 10.18 shows an example of the setting procedure for cascaded operation. cascaded operation set cascading start count [1] [2] [1] set bits tpsc2 to tpsc0 in the channel 1 tcr to b'1111 to select tcnt_2 overflow/ underflow counting. [2] set the cst bit in tstr for the upper and lower channel to 1 to start the count operation. figure 10.18 cascaded op eration setting procedure
rev. 2.00, 09/04, page 207 of 720 examples of cascaded operation: figure 10.19 illustrates the operation when tcnt_2 overflow/underflow counting has been set for tcnt_1 and phase counting mode has been designated for channel 2. tcnt_1 is incremented by tcnt_2 overflow and decremented by tcnt_2 underflow. tclkc tcnt_2 fffd tcnt_1 0001 tclkd fffe ffff 0000 0001 0002 0001 0000 ffff 0000 0000 figure 10.19 example of cascaded operation 10.4.5 pwm modes in pwm mode, pwm waveforms are output from the output pins. the output level can be selected as 0, 1, or toggle output in respon se to a compare match of each tgr. tgr registers settings can be used to output a pwm waveform in the range of 0% to 100% duty. designating tgr compare match as the counter clearin g source enables the period to be set in that register. all channels can be designated for pwm mode independently. synchronous operation is also possible. there are two pwm modes, as described below. 1. pwm mode 1 pwm output is generated from the tioca and tiocc pins by pairing tgra with tgrb and tgrc with tgrd. the output specified by bits ioa0 to ioa3 and ioc0 to ioc3 in tior is output from the tioca and tiocc pins at compare matches a and c, and the output specified by bits iob0 to iob3 and iod0 to iod3 in tior is output at compare matches b and d. the initial output value is the value set in tgra or tgrc. if the set values of paired tgrs are identical, the output value does not change when a compare match occurs. in pwm mode 1, a maximum 8-phase pwm output is possible.
rev. 2.00, 09/04, page 208 of 720 2. pwm mode 2 pwm output is generated using one tgr as the cycle register and the others as duty registers. the output specified in tior is performed by means of compare matches. upon counter clearing by a synchronization regi ster compare match, the output va lue of each pin is the initial value set in tior. if the set values of the cy cle and duty registers ar e identical, the output value does not change when a compare match occurs. in pwm mode 2, a maximum 8-phase pwm output is possible in combination use with synchronous operation. the correspondence between pwm output pins and registers is shown in table 10.31. table 10.31 pwm output registers and output pins output pins channel registers pwm mode 1 pwm mode 2 tgra_0 tioc0a tgrb_0 tioc0a tioc0b tgrc_0 tioc0c 0 tgrd_0 tioc0c tioc0d tgra_1 tioc1a 1 tgrb_1 tioc1a tioc1b tgra_2 tioc2a 2 tgrb_2 tioc2a tioc2b tgra_3 cannot be set tgrb_3 tioc3a cannot be set tgrc_3 cannot be set 3 tgrd_3 tioc3c cannot be set tgra_4 cannot be set tgrb_4 tioc4a cannot be set tgrc_4 cannot be set 4 tgrd_4 tioc4c cannot be set note: in pwm mode 2, pwm output is not possible fo r the tgr register in which the period is set.
rev. 2.00, 09/04, page 209 of 720 example of pwm mode setting procedure: figure 10.20 shows an example of the pwm mode setting procedure. pwm mode select counter clock select counter clearing source select waveform output level set tgr set pwm mode start count [1] [2] [3] [4] [5] [6] [1] select the counter clock with bits tpsc2 to tpsc0 in tcr. at the same time, select the input clock edge with bits ckeg1 and ckeg0 in tcr. [2] use bits cclr2 to cclr0 in tcr to select the tgr to be used as the tcnt clearing source. [3] use tior to designate the tgr as an output compare register, and select the initial value and output value. [4] set the cycle in the tgr selected in [2], and set the duty in the other tgr. [5] select the pwm mode with bits md3 to md0 in tmdr. [6] set the cst bit in tstr to 1 to start the count operation. figure 10.20 example of pwm mode setting procedure examples of pwm mode operation: figure 10.21 shows an example of pwm mode 1 operation. in this example, tgra compare match is set as the tcnt clearing source, 0 is set for the tgra initial output value and output value, and 1 is set as the tgrb output value. in this case, the value set in tgra is used as the period, and the values set in the tgrb registers are used as the duty cycle. tcnt value tgra h'0000 tioca time tgrb counter cleared by tgra compare match figure 10.21 example of pwm mode operation (1)
rev. 2.00, 09/04, page 210 of 720 figure 10.22 shows an example of pwm mode 2 operation. in this example, synchronous operation is designated for channels 0 and 1, tgrb_1 compare match is set as the tcnt clearing source, and 0 is set for the initial output value and 1 for the output value of the other tgr registers (tgra_0 to tgrd_0, tgra_1), outputting a 5-phase pwm waveform. in this case, the value set in tgrb_1 is used as th e cycle, and the values set in the other tgrs are used as the duty levels. tcnt value tgrb_1 h'0000 tioc0a counter cleared by tgrb_1 compare match time tgra_1 tgrd_0 tgrc_0 tgrb_0 tgra_0 tioc0b tioc0c tioc0d tioc1a figure 10.22 example of pwm mode operation (2)
rev. 2.00, 09/04, page 211 of 720 figure 10.23 shows examples of pwm waveform output with 0% duty cycle and 100% duty cycle in pwm mode. tcnt value tgra h'0000 tioca time tgrb 0% duty cycle tgrb rewritten tgrb rewritten tgrb rewritten tcnt value tgra h'0000 tioca time tgrb 100% duty cycle tgrb rewritten tgrb rewritten tgrb rewritten output does not change when cycle register and duty register compare matches occur simultaneously tcnt value tgra h'0000 tioca time tgrb 100% duty cycle tgrb rewritten tgrb rewritten tgrb rewritten output does not change when cycle register and duty register compare matches occur simultaneously 0% duty cycle figure 10.23 example of pwm mode operation (3)
rev. 2.00, 09/04, page 212 of 720 10.4.6 phase counting mode in phase counting mode, the phase difference betw een two external clock inputs is detected and tcnt counts up or down accordingly. this mode can be set for channels 1 and 2. when phase counting mode is set, an external cl ock is selected as the counter input clock and tcnt operates as an up/down-counter regardless of the setting of bits tpsc0 to tpsc2 and bits ckeg0 and ckeg1 in tcr. however, the functions of bits cclr0 and cclr1 in tcr, and of tior, tier, and tgr, are valid, and input capture/compare match and interrupt functions can be used. this can be used for two-phase encoder pulse input. if overflow occurs when tcnt is counting up, the tcfv flag in tsr is set; if underflow occurs when tcnt is counting down, the tcfu flag is set. the tcfd bit in tsr is the count direction flag. reading the tcfd flag reveals whether tcnt is counting up or down. table 10.32 shows the correspondence between external clock pins and channels. table 10.32 phase counting mode clock input pins external clock pins channels a-phase b-phase when channel 1 is set to phase counting mode tclka tclkb when channel 2 is set to phase counting mode tclkc tclkd example of phase counting mode setting procedure: figure 10.24 shows an example of the phase counting mode setting procedure. phase counting mode select phase counting mode start count [1] [2] [1] select phase counting mode with bits md3 to md0 in tmdr. [2] set the cst bit in tstr to 1 to start the count operation. figure 10.24 example of phase counting mode setting procedure
rev. 2.00, 09/04, page 213 of 720 examples of phase counting mode operation: in phase counting mode, tcnt counts up or down according to the phase difference between two external clocks. there are four modes, according to the count conditions. 1. phase counting mode 1 figure 10.25 shows an example of phase counting mode 1 operation, and table 10.33 summarizes the tcnt up/down-count conditions. tcnt value time tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) up-count down-count figure 10.25 example of phase counting mode 1 operation table 10.33 up/down-count condit ions in phase counting mode 1 tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) operation high level up-count low level low level high level high level down-count low level high level low level [legend] : rising edge : falling edge
rev. 2.00, 09/04, page 214 of 720 2. phase counting mode 2 figure 10.26 shows an example of phase counting mode 2 operation, and table 10.34 summarizes the tcnt up/down-count conditions. time down-count up-count tcnt value tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) figure 10.26 example of phase counting mode 2 operation table 10.34 up/down-count condit ions in phase counting mode 2 tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) operation high level don?t care low level don?t care low level don?t care high level up-count high level don?t care low level don?t care high level don?t care low level down-count [legend] : rising edge : falling edge
rev. 2.00, 09/04, page 215 of 720 3. phase counting mode 3 figure 10.27 shows an example of phase counting mode 3 operation, and table 10.35 summarizes the tcnt up/down-count conditions. time up-count down-count tcnt value tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) figure 10.27 example of phase counting mode 3 operation table 10.35 up/down-count condit ions in phase counting mode 3 tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) operation high level don?t care low level don?t care low level don?t care high level up-count high level down-count low level don?t care high level don?t care low level don?t care [legend] : rising edge : falling edge
rev. 2.00, 09/04, page 216 of 720 4. phase counting mode 4 figure 10.28 shows an example of phase counting mode 4 operation, and table 10.36 summarizes the tcnt up/down-count conditions. time up-count down-count tcnt value tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) figure 10.28 example of phase counting mode 4 operation table 10.36 up/down-count condit ions in phase counting mode 4 tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) operation high level up-count low level low level don?t care high level high level down-count low level high level don?t care low level [legend] : rising edge : falling edge
rev. 2.00, 09/04, page 217 of 720 phase counting mode application example: figure 10.29 shows an example in which channel 1 is in phase counting mode, and channel 1 is coupled with channel 0 to input servo motor 2-phase encoder pulses in order to detect position or speed. channel 1 is set to phase counting mode 1, and the encoder pulse a-phase and b-phase are input to tclka and tclkb. channel 0 operates with tcnt counter clearing by tgrc_0 compare match; tgra_0 and tgrc_0 are used for the compare match function an d are set with the speed control period and position control period. tgrb_0 is used for input capture, with tgrb_0 and tgrd_0 operating in buffer mode. the channel 1 counter input clock is designated as the tgrb_0 input capture source, and the pulse widths of 2-phase encoder 4-multiplication pulses are detected. tgra_1 and tgrb_1 for channel 1 are designated for input capture, and channel 0 tgra_0 and tgrc_0 compare matches are selected as the inpu t capture source and store the up/down-counter values for the control periods. this procedure enables the accurate detection of position and speed. tcnt_1 tcnt_0 channel 1 tgra_1 (speed period capture) tgra_0 (speed control period) tgrb_1 (position period capture) tgrc_0 (position control period) tgrb_0 (pulse width capture) tgrd_0 (buffer operation) channel 0 tclka tclkb edge detection circuit + - + - figure 10.29 phase counting mode application example
rev. 2.00, 09/04, page 218 of 720 10 . 4.7 reset-synchronized pwm mode in the reset-synchronized pwm mode, three-phase output of positive and negative pwm waveforms that share a common wave transition point can be obtained by combining channels 3 and 4. when set for reset-synchronized pwm mode, the tioc3b, tioc3d, tioc4a, tioc4c, tioc4b, and tioc4d pins function as pwm output pins and tcnt3 functions as an upcounter. table 10.37 shows the pwm output pins used. table 10.38 shows the settings of the registers. table 10.37 output pins for reset-synchronized pwm mode channel output pin description 3 tioc3b pwm output pin 1 tioc3d pwm output pin 1' (negativ e-phase waveform of pwm output 1) 4 tioc4a pwm output pin 2 tioc4c pwm output pin 2' (negativ e-phase waveform of pwm output 2) tioc4b pwm output pin 3 tioc4d pwm output pin 3' (negativ e-phase waveform of pwm output 3) table 10.38 register settings fo r reset-synchronized pwm mode register description of setting tcnt_3 initial setting of h'0000 tcnt_4 initial setting of h'0000 tgra_3 set count cycle for tcnt_3 tgrb_3 sets the turning point for pwm wavefo rm output by the tioc3b and tioc3d pins tgra_4 sets the turning point for pwm wavefo rm output by the tioc4a and tioc4c pins tgrb_4 sets the turning point for pwm wavefo rm output by the tioc4b and tioc4d pins
rev. 2.00, 09/04, page 219 of 720 procedure for selecting the reset-synchronized pwm mode: figure 10.30 shows an example of procedure for selecting the reset synchronized pwm mode. 1. clear the cst3 and cst4 bits in the tstr to 0 to halt the counting of tcnt. the reset- synchronized pwm mode must be set up while tcnt_3 and tcnt_4 are halted. 2. set bits tpsc2?tpsc0 and ckeg1 and ckeg0 in the tcr_3 to select the counter clock and clock edge for channel 3. set bits cclr2?cclr0 in the tcr_3 to select tgra compare- match as a counter clear source. 3. when performing brushless dc motor control, set bit bdc in the timer gate control register (tgcr) and set the feedback signal input source and output chopping or gate signal direct output. 4. reset tcnt_3 and tcnt_4 to h'0000. 5. tgra_3 is the period register. set the waveform period value in tgra_3. set the transition timing of the pwm output waveforms in tgrb_3, tgra_4, and tgrb_4. set times within the compare-match range of tcnt_3. x tgra_3 (x: set value). 6. select enabling/disabling of toggle output synchronized with the pmw cycle using bit psye in the timer output control register (tocr), and set the pwm output level with bits olsp and olsn. 7. set bits md3?md0 in tmdr_3 to b'1000 to select the reset-synchronized pwm mode. tioc3a, tioc3b, tioc3d, tioc4a, tioc4b, tioc4c and tioc4d function as pwm output pins*. do not set to tmdr_4. 8. set the enabling/disabling of the pwm waveform output pin in toer. 9. set the cst3 bit in the tstr to 1 to start the count operation. notes: 1. the output waveform starts to toggle operation at the point of tcnt_3 = tgra_3 = x by setting x = tgra, i.e., cycle = duty. * pfc registers should be specified before this procedure.
rev. 2.00, 09/04, page 220 of 720 7 1 2 3 4 stop counting select counter clock and counter clear source set tgr reset-synchronized pwm mode brushless dc motor control setting set tcnt 5 enable waveform output set reset-synchronized pwm mode 6 pwm cycle output enabling, pwm output level setting 8 start count operation 9 reset-synchronized pwm mode figure 10.30 procedure for selecting the reset-synchronized pwm mode
rev. 2.00, 09/04, page 221 of 720 reset-synchronized pwm mode operation: figure 10.31 shows an example of operation in the reset-synchronized pwm mode. tcnt_3 and tcnt_4 operate as upcounters. the counter is cleared when a tcnt_3 and tgra_3 compare-match occurs, and then begins counting up from h'0000. the pwm output pin output toggles wi th each occurrence of a tgrb_3, tgra_4, tgrb_4 compare-match, a nd upon counter clears. tcnt_3 and tcnt_4 values tgra_3 tgrb_3 tgra_4 tgrb_4 h'0000 tioc3b tioc4a tioc4b tioc4c tioc4d tioc3d time figure 10.31 reset-synchronized pwm mo de operation example (when the tocr?s olsn = 1 and olsp = 1)
rev. 2.00, 09/04, page 222 of 720 10.4.8 complementary pwm mode in the complementary pwm mode, three-phase output of non-overlapping positive and negative pwm waveforms can be obtained by combining channels 3 and 4. in complementary pwm mode, tioc3b, tioc3d, tioc4a, tioc4b, tioc4c, and tioc4d pins function as pwm output pins, the tioc3a pin can be set for toggle output synchronized with the pwm period. tcnt_3 and tcnt_4 func tion as increment/decrement counters. table 10.39 shows the pwm output pins used. table 10.40 shows the settings of the registers used. a function to directly cut off the pwm output by using an external signal is supported as a port function. table 10.39 output pins fo r complementary pwm mode channel output pin description 3 tioc3a toggle output synchroni zed with pwm period (or i/o port) tioc3b pwm output pin 1 tioc3c i/o port * tioc3d pwm output pin 1' (non-overlapping negative-phase waveform of pwm output 1) 4 tioc4a pwm output pin 2 tioc4b pwm output pin 3 tioc4c pwm output pin 2' (non-overlapping negative-phase waveform of pwm output 2) tioc4d pwm output pin 3' (non-overlapping negative-phase waveform of pwm output 3) note: * avoid setting the tioc3c pin as a time r i/o pin in the complementary pwm mode.
rev. 2.00, 09/04, page 223 of 720 table 10.40 register settings for complementary pwm mode channel counter/register descri ption read/write from cpu 3 tcnt_3 start of up-count from value set in dead time register maskable by bsc/bcr1 setting * tgra_3 set tcnt_3 upper limit value (1/2 carrier cycle + dead time) maskable by bsc/bcr1 setting * tgrb_3 pwm output 1 compare r egister maskable by bsc/bcr1 setting * tgrc_3 tgra_3 buffer register always readable/writable tgrd_3 pwm output 1/tgrb_3 buffer register always readable/writable 4 tcnt_4 up-count start, initialized to h'0000 maskable by bsc/bcr1 setting * tgra_4 pwm output 2 compare r egister maskable by bsc/bcr1 setting * tgrb_4 pwm output 3 compare r egister maskable by bsc/bcr1 setting * tgrc_4 pwm output 2/tgra_4 buffer register always readable/writable tgrd_4 pwm output 3/tgrb_4 buffer register always readable/writable timer dead time data register (tddr) set tcnt_4 and tcnt_3 offset value (dead time value) maskable by bsc/bcr1 setting * timer cycle data register (tcdr) set tcnt_4 upper limit value (1/2 carrier cycle) maskable by bsc/bcr1 setting * timer cycle buffer register (tcbr) tcdr buffer register always readable/writable subcounter (tcnts) subcounter for dead time generation read-only temporary register 1 (temp1) pwm output 1/tgrb_3 temporary register not readable/writable temporary register 2 (temp2) pwm output 2/tgra_4 temporary register not readable/writable temporary register 3 (temp3) pwm output 3/tgrb_4 temporary register not readable/writable note: * access can be enabled or disabled according to the setting of bit 13 (mturwe) in bsc/bcr1 (bus controller/bus control register 1).
rev. 2.00, 09/04, page 224 of 720 tgrc_3 tddr tcnt_3 tgrd_3 tgrd_4 tgrc_4 tgrb_3 temp 1 tgra_4 temp 2 tgrb_4 temp 3 tcnts tcnt_4 tgra_3 tcdr tcbr comparator comparator match signal match signal output controller output protection circuit pwm cycle output pwm output 1 pwm output 2 pwm output 3 pwm output 4 pwm output 5 pwm output 6 poe0 poe1 poe2 poe3 external cutoff input external cutoff interrupt : registers that can always be read or written from the cpu : registers that cannot be read or written from the cpu (except for tcnts, which can only be read) : registers that can be read or written from the cpu (but for which access disabling can be set by the bus controller) tgra_3 compare- match interrupt tcnt_4 underflow interrupt figure 10.32 block diagram of channels 3 and 4 in complementary pwm mode
rev. 2.00, 09/04, page 225 of 720 example of complementary pwm mode setting procedure: an example of the complementary pwm mode setting procedure is shown in figure 10.33. 1. clear bits cst3 and cst4 in the timer start register (tstr) to 0, and halt timer counter (tcnt) operation. perform complementary pwm mode setting when tcnt_3 and tcnt_4 are stopped. 2. set the same counter clock and clock edge for channels 3 and 4 with bits tpsc2?tpsc0 and bits ckeg1 and ckeg0 in the timer control register (tcr). use bits cclr2?cclr0 to set synchronous clearing only when restarting by a synchronous clear from another channel during complementary pwm mode operation. 3. when performing brushless dc motor control, set bit bdc in the timer gate control register (tgcr) and set the feedback signal input source and output chopping or gate signal direct output. 4. set the dead time in tcnt_3. set tcnt_4 to h'0000. 5. set only when restarting by a synchronous clear from another channel during complementary pwm mode operation. in this case, synchronize the channel generating the synchronous clear with channels 3 and 4 using the timer synchro register (tsyr). 6. set the output pwm duty in the duty registers (tgrb_3, tgra_4, tgrb_4) and buffer registers (tgrd_3, tgrc_4, tgrd_4). set the same initial value in each corresponding tgr. 7. set the dead time in the dead time register (t ddr), 1/2 the carrier cycle in the carrier cycle data register (tcdr) and carrier cycle buffer register (tcbr), and 1/2 the carrier cycle plus the dead time in tgra_3 and tgrc_3. 8. select enabling/disabling of toggle output synchronized with the pwm cycle using bit psye in the timer output control register (tocr), and set the pwm output level with bits olsp and olsn. 9. select complementary pwm mode in timer mode register 3 (tmdr_3). pins tioc3a, tioc3b, tioc3d, tioc4a, tioc4b, tioc4c, and tioc4d function as output pins*. do not set in tmdr_4. 10. set enabling/disabling of pwm waveform output pin output in the timer output master enable register (toer). 11. set the port control and port i/o registers. 12. set bits cst3 and cst4 in tstr to 1 simultaneously to start the count operation.
rev. 2.00, 09/04, page 226 of 720 complementary pwm mode stop count operation counter clock, counter clear source selection brushless dc motor control setting tcnt setting inter-channel synchronization setting tgr setting dead time, carrier cycle setting pwm cycle output enabling, pwm output level setting complementary pwm mode setting 3 enable waveform output start count operation 2 4 5 6 7 8 9 10 12 pfc setting 11 1 figure 10.33 example of complementary pwm mode setting procedure
rev. 2.00, 09/04, page 227 of 720 outline of complementary pwm mode operation: in complementary pwm mode, 6-phase pwm output is possible. figure 10.34 illustrates counter operation in complementary pwm mode, and figure 10.35 shows an example of complementary pwm mode operation. 1. counter operation in complementary pwm mode, three counters ? tcnt_3, tcnt_4, and tcnts ? perform up/down-count operations. tcnt_3 is automatically initialized to the value set in tddr when complementary pwm mode is selected and the cst bit in tstr is 0. when the cst bit is set to 1, tcnt_3 counts up to the value set in tgra_3, then switches to down-counting when it matches tgra_3. when the tcnt3 value matches tddr, the counter switches to up-counting, and the operation is repeated in this way. tcnt_4 is initialized to h'0000. when the cst bit is set to 1, tcnt4 counts up in synchronization with tcnt_3, and switches to down-counting when it matches tcdr. on reaching h'0000, tcnt4 switches to up-counting, and the operation is repeated in this way. tcnts is a read-only counter. it need not be initialized. when tcnt_3 matches tcdr during tcnt_3 and tcnt_4 up/down-counting, down- counting is started, and when tcnts matches tcdr, the operation switches to up-counting. when tcnts matches tgra_3, it is cleared to h'0000. when tcnt_4 matches tddr during tcnt_3 and tcnt_4 down-counting, up-counting is started, and when tcnts matches tddr, the operation switches to down-counting. when tcnts reaches h'0000, it is set with the value in tgra_3. tcnts is compared with the co mpare register and temporary register in which the pwm duty is set during the count operation only. counter value tgra_3 tcdr tddr h'0000 tcnt_4 tcnts tcnt_3 tcnt_3 tcnt_4 tcnts time figure 10.34 complementary pwm mode counter operation
rev. 2.00, 09/04, page 228 of 720 2. register operation in complementary pwm mode, nine registers are used, comprising compar e registers, buffer registers, and temporary registers. figure 10.35 shows an example of complementary pwm mode operation. the registers which are constantly compared with the counters to perform pwm output are tgrb_3, tgra_4, and tgrb_4. when these registers match the counter, the value set in bits olsn and olsp in the timer output control register (tocr) is output. the buffer registers for th ese compare registers are tgrd_3, tgrc_4, and tgrd_4. between a buffer register and compare register there is a temporary register. the temporary registers cannot be accessed by the cpu. data in a compare register is changed by writing the new data to the corresponding buffer register. the buffer registers can be read or written at any time. the data written to a buffer register is constantly transferred to the tempor ary register in the ta interval. data is not transferred to the temporary register in the tb interval. data written to a buffer register in this interval is transferred to the temporary register at the end of the tb interval. the value transferred to a temporary register is transferred to the compare register when tcnts for which the tb interval ends matches tgra_3 when counting up, or h'0000 when counting down. the timing for transfer from the temporary register to the compare register can be selected with bits md3?md0 in the timer mode register (tmdr). figure 10.35 shows an example in which the mode is selected in which the change is made in the trough. in the tb interval (tb1 in figure 10.35) in whic h data transfer to the temporary register is not performed, the temporary register has the same function as the compare register, and is compared with the counter. in this interval, therefore, there are two compare match registers for one-phase output, with the compare register containing the pre-change data, and the temporary register containing the new data . in this interval, the three counters ? tcnt_3, tcnt_4, and tcnts ? and two registers ? compare register and temporary register ? are compared, and pwm output controlled accordingly.
rev. 2.00, 09/04, page 229 of 720 tgra_3 tcdr tgra_4 tgrc_4 tddr h'0000 buffer register tgrc_4 temporary register temp2 compare register tgra_4 output waveform output waveform tb2 ta tb1 ta tb2 ta tcnt_3 tcnt_4 tcnts (output waveform is active-low) h'6400 h'0080 h'6400 h'6400 h'0080 h'0080 transfer from temporary register to compare register transfer from temporary register to compare register figure 10.35 example of complementary pwm mode operation
rev. 2.00, 09/04, page 230 of 720 3. initialization in complementary pwm mode, there are si x registers that must be initialized. before setting complementary pwm mode with bits md3?md0 in the timer mode register (tmdr), the following initial register values must be set. tgrc_3 operates as the buffer register for tgra_3, and should be set with 1/2 the pwm carrier cycle + dead time td. the timer cycle buffer register (tcbr) operates as the buffer register for the timer cycle data register (tcd r), and should be set with 1/2 the pwm carrier cycle. set dead time td in the timer dead time data register (tddr). set the respective initial pwm duty values in buffer registers tgrd_3, tgrc_4, and tgrd_4. the values set in the five buffer registers excluding tddr are transferred simultaneously to the corresponding compare registers when complementary pwm mode is set. set tcnt_4 to h'0000 before setting complementary pwm mode. table 10.41 registers and count ers requiring initialization register/counter set value tgrc_3 1/2 pwm carrier cycle + dead time td tddr dead time td tcbr 1/2 pwm carrier cycle tgrd_3, tgrc_4, tgrd_4 initial pwm duty value for each phase tcnt_4 h'0000 note: the tgrc_3 set value must be the sum of 1/2 the pwm carrier cycle set in tcbr and dead time td set in tddr. 4. pwm output level setting in complementary pwm mode, the pwm pulse output level is set with bits olsn and olsp in the timer output control register (tocr). the output level can be set for each of the three positive phases and three negative phases of 6- phase output. complementary pwm mode should be cleared before setting or changing output levels. 5. dead time setting in complementary pwm mode, pwm pulses are output with a non-overlapping relationship between the positive and negative phases. this non-overlap time is called the dead time. the non-overlap time is set in the timer dead time data register (tddr). the value set in tddr is used as the tcnt_3 counter start va lue, and creates non-overlap between tcnt_3 and tcnt_4. complementary pwm mode should be cleared before changing the contents of tddr.
rev. 2.00, 09/04, page 231 of 720 6. pwm cycle setting in complementary pwm mode, the pwm pul se cycle is set in two registers ? tgra_3, in which the tcnt_3 upper limit value is set, and tcdr, in which the tcnt_4 upper limit value is set. the settings should be made so as to achieve the following relationship between these two registers: tgra_3 set value = tcdr set value + tddr set value the tgra_3 and tcdr settings are made by setting the values in buffer registers tgrc_3 and tcbr. the values set in tgrc_3 and tcbr are transferred simultaneously to tgra_3 and tcdr in accordance with th e transfer timing selected w ith bits md3?md0 in the timer mode register (tmdr). the updated pwm cycle is reflected from the next cycle when the data update is performed at the crest, and from the current cycle when perfor med in the trough. figure 10.36 illustrates the operation when the pwm cycle is updated at the crest. see the following section, register data updating, for the method of updating the data in each buffer register. counter value tgrc_3 update tgra_3 update tgra_3 tcnt_3 tcnt_4 time figure 10.36 example of pwm cycle updating
rev. 2.00, 09/04, page 232 of 720 7. register data updating in complementary pwm mode, the buffer register is used to update the data in a compare register. the update data can be written to the bu ffer register at any tim e. there are five pwm duty and carrier cycle registers that have buffer registers and can be updated during operation. there is a temporary register between each of these registers and its buffer register. when subcounter tcnts is not counting, if buffer regi ster data is updated, the temporary register value is also rewritten. transfer is not perfor med from buffer registers to temporary registers when tcnts is counting; in this case, the value wr itten to a buffer regist er is transferred after tcnts halts. the temporary register value is transferred to the compare regist er at the data update timing set with bits md3?md0 in the timer mode register (tmdr). figure 10.37 shows an example of data updating in complementary pwm mode. this example shows the mode in which data updating is performed at both the counter crest and trough. when rewriting buffer register data, a write to tgrd_4 must be performed at the end of the update. data transfer from the buffer regist ers to the temporary registers is performed simultaneously for all five registers after the write to tgrd_4. a write to tgrd_4 must be performed after writin g data to the registers to be updated, even when not updating all five registers, or when updating the tgrd_4 data. in this case, the data written to tgrd_4 should be the same as the data prior to the write operation.
rev. 2.00, 09/04, page 233 of 720 data update timing: counter crest and trough transfer from temporary register to compare register transfer from temporary register to compare register transfer from temporary register to compare register transfer from temporary register to compare register transfer from temporary register to compare register transfer from temporary register to compare register counter value tgra_3 tgrc_4 tgra_4 h'0000 br data1 data2 data3 data4 data5 data6 data1 data1 data2 data3 data4 data6 data2 data3 data4 data5 data6 temp_r gr time : compare register : buffer register figure 10.37 example of data update in complementary pwm mode
rev. 2.00, 09/04, page 234 of 720 8. initial output in complementary pwm mode in complementary pwm mode, the initial output is determined by the setting of bits olsn and olsp in the timer output control register (tocr). this initial output is the pwm pulse non-active level, and is output from when complementary pwm mode is set with the timer mode register (tmdr) until tcnt_4 exceeds the value set in the dead time register (tddr). figure 10.38 shows an example of the initial output in complementary pwm mode. an example of the waveform when the initial pwm duty value is smaller than the tddr value is shown in figure 10.39. timer output control register settings olsn bit: 0 (initial output: high; active level: low) olsp bit: 0 (initial output: high; active level: low) tcnt3, 4 value tgr4_a tddr tcnt_3 tcnt_4 initial output dead time time active level active level tcnt3, 4 count start (tstr setting) complementary pwm mode (tmdr setting) positive phase output negative phase output figure 10.38 example of initial ou tput in complementary pwm mode (1)
rev. 2.00, 09/04, page 235 of 720 timer output control register settings olsn bit: 0 (initial output: high; active level: low) olsp bit: 0 (initial output: high; active level: low) tcnt_3, 4 value tgr_4 tddr tcnt_3 tcnt_4 initial output time active level tcnt_3, 4 count start (tstr setting) complementary pwm mode (tmdr setting) positive phase output negative phase output figure 10.39 example of initial output in complementary pwm mode (2)
rev. 2.00, 09/04, page 236 of 720 9. complementary pwm mode pwm output generation method in complementary pwm mode, 3-phase output is performed of pwm waveforms with a non- overlap time between the positive and negative phases. this non-overlap time is called the dead time. a pwm waveform is generated by output of the output level selected in the timer output control register in the event of a compare-match between a co unter and data register. while tcnts is counting, data register and temporary register values are si multaneously compared to create consecutive pw m pulses from 0 to 100%. the relative timing of on and off compare- match occurrence may vary, but the compare-matc h that turns off each phase takes precedence to secure the dead time and ensure that the positive phase and negative phase on times do not overlap. figures 10.40 to 10.42 show examples of waveform generation in complementary pwm mode. the positive phase/negative phase off timing is generated by a compare-match with the solid- line counter, and the on timing by a compare-matc h with the dotted-line counter operating with a delay of the dead time behind the solid-lin e counter. in the t1 period, compare-match a that turns off the negative phase has the highest priority, and compare-matches occurring prior to a are ignored. in the t2 period, compare-match c that turns off the positive phase has the highest priority, and compare-matches occurring prior to c are ignored. in normal cases, compare-matches occur in the order a b c d (or c d a' b' ), as shown in figure 10.40. if compare-matches deviate from the a b c d order, since the time for which the negative phase is off is less than twice the dead time, the figure shows the positive phase is not being turned on. if compare-matches deviate from the c d a' b' order, since the time for which the positive phase is off is less than twice the dead time, the figure shows the negative phase is not being turned on. if compare-match c occurs first following compare-match a , as shown in figure 10.41, compare-match b is ignored, and the negative phas e is turned off by compare-match d . this is because turning off of the pos itive phase has priority due to the occurrence of compare-match c (positive phase off timing) before compare-match b (positive phase on timing) (consequently, the waveform does not change since the positive phase goes from off to off). similarly, in the example in figure 10.42, compare-match a' with the new data in the temporary register occurs before compare-match c , but other compare-matches occurring up to c , which turns off the positive phase, are ignored. as a result, the positive phase is not turned on. thus, in complementary pwm mode, compare-matches at turn-off timings take precedence, and turn-on timing compare-ma tches that occur before a turn-off timing compare-match are ignored.
rev. 2.00, 09/04, page 237 of 720 t2 period t1 period t1 period ab c a' b' d tgr3a_3 tcdr tddr h'0000 positive phase negative phase figure 10.40 example of complementary pwm mode waveform output (1) t2 period t1 period t1 period tgra_3 tcdr tddr h'0000 positive phase negative phase c d a a b b figure 10.41 example of complementary pwm mode waveform output (2)
rev. 2.00, 09/04, page 238 of 720 ab c a' b' d t1 period t2 period t1 period tgra_3 tcdr tddr h'0000 positive phase negative phase figure 10.42 example of complementary pwm mode waveform output (3) a b c d a' b' t2 period t1 period t1 period tgra_3 tcdr tddr h'0000 positive phase negative phase figure 10.43 example of complementary pwm mode 0% and 100% waveform output (1)
rev. 2.00, 09/04, page 239 of 720 t2 period t1 period t1 period tgra_3 tcdr tddr h'0000 positive phase negative phase a c d a b b figure 10.44 example of complementary pwm mode 0% and 100% waveform output (2) t2 period t1 period t1 period a b c d tgra_3 tcdr tddr h'0000 positive phase negative phase figure 10.45 example of complementary pwm mode 0% and 100% waveform output (3)
rev. 2.00, 09/04, page 240 of 720 tgra_3 tcdr tddr h'0000 positive phase negative phase t2 period t1 period t1 period a b c b' d a' figure 10.46 example of complementary pwm mode 0% and 100% waveform output (4) cad b t2 period t1 period t1 period tgra_3 tcdr tddr h'0000 positive phase negative phase figure 10.47 example of complementary pwm mode 0% and 100% waveform output (5)
rev. 2.00, 09/04, page 241 of 720 10. complementary pwm mode 0% and 100% duty output in complementary pwm mode, 0% and 100% duty cycles can be output as required. figures 10.43 to 10.47 show output examples. 100% duty output is performed when the data register value is set to h'0000. the waveform in this case has a positive phase with a 100% on-state. 0% duty output is performed when the data register value is set to the same value as tg ra_3. the waveform in this case has a positive phase with a 100% off-state. on and off compare-matches occur simultaneously, but if a turn-on compare-match and turn- off compare-match for the same phase occur simultaneously, both compare-matches are ignored and the waveform does not change. 11. toggle output synchronized with pwm cycle in complementary pwm mode, toggle output can be performed in synchronization with the pwm carrier cycle by setting the psye bit to 1 in the timer output control register (tocr). an example of a toggle output waveform is shown in figure 10.48. this output is toggled by a compare-match between tcnt_3 and tg ra_3 and a compare- match between tcnt4 and h'0000. the output pin for this toggle output is the tioc3a pin. the initial output is 1. tgra_3 h'0000 toggle output tioc3a pin tcnt_4 tcnt_3 figure 10.48 example of toggle output waveform synchronized with pwm output
rev. 2.00, 09/04, page 242 of 720 12. counter clearing by another channel in complementary pwm mode, by setting a mode for synchronization with another channel by means of the timer synchro register (tsyr), and selecting synchronous clearing with bits cclr2?cclr0 in the timer control register (tcr), it is possible to have tcnt_3, tcnt_4, and tcnts cleared by another channel. figure 10.49 illustrates the operation. use of this function enables counter clearing and restarting to be performed by means of an external signal. tgra_3 tcdr tddr h'0000 channel 1 input capture a tcnt_1 tcnt_3 tcnt_4 tcnts synchronous counter clearing by channel 1 input capture a figure 10.49 counter clearing sy nchronized with another channel
rev. 2.00, 09/04, page 243 of 720 13. example of ac synchronous motor (brushless dc motor) drive waveform output in complementary pwm mode, a brushless dc motor can easily be controlled using the timer gate control register (tgcr). figures 10.50 to 10.53 show examples of brushless dc motor drive waveforms created using tgcr. when output phase switching for a 3-phase brushless dc motor is performed by means of external signals detected with a hall element, etc ., clear the fb bit in tgcr to 0. in this case, the external signals indicating the polarity position are input to channel 0 timer input pins tioc0a, tioc0b, and tioc0c (set with pfc). when an edge is detected at pin tioc0a, tioc0b, or tioc0c, the output on/o ff state is switched automatically. when the fb bit is 1, the output on/off state is switched when the uf, vf, or wf bit in tgcr is cleared to 0 or set to 1. the drive waveforms are output from the complementary pwm mode 6-phase output pins. with this 6-phase output, in the case of on output, it is possible to use complementary pwm mode output and perform chopping output by setting the n bit or p bit to 1. when the n bit or p bit is 0, level output is selected. the 6-phase output active level (on output level) can be set with the olsn and olsp bits in the timer output control register (tocr) regardless of the setting of the n and p bits. external input tioc0a pin tioc0b pin tioc0c pin tioc3b pin tioc3d pin tioc4a pin tioc4c pin tioc4b pin tioc4d pin 6-phase output when bdc = 1, n = 0, p = 0, fb = 0, output active level = high figure 10.50 example of output phase switching by external input (1)
rev. 2.00, 09/04, page 244 of 720 external input tioc0a pin tioc0b pin tioc0c pin tioc3b pin tioc3d pin tioc4a pin tioc4c pin tioc4b pin tioc4d pin 6-phase output when bdc = 1, n = 1, p = 1, fb = 0, output active level = high figure 10.51 example of output phase switching by external input (2) tgcr uf bit vf bit wf bit tioc3b pin tioc3d pin tioc4a pin tioc4c pin tioc4b pin tioc4d pin 6-phase output when bdc = 1, n = 0, p = 0, fb = 1, output active level = high figure 10.52 example of output phase switching by means of uf, vf, wf bit settings (1)
rev. 2.00, 09/04, page 245 of 720 tgcr uf bit vf bit wf bit tioc3b pin tioc3d pin tioc4a pin tioc4c pin tioc4b pin tioc4d pin 6-phase output when bdc = 1, n = 1, p = 1, fb = 1, output active level = high figure 10.53 example of output phase switching by means of uf, vf, wf bit settings (2) 14. a/d conversion start request setting in complementary pwm mode, an a/d conversion start request can be set using a tgra_3 compare-match or a compare-match on a channel other than channels 3 and 4. when start requests using a tgra_3 compare-matc h are set, a/d conversion can be started at the center of the pwm pulse. a/d conversion start requests can be set by setting the ttge bit to 1 in the timer interrupt enable register (tier).
rev. 2.00, 09/04, page 246 of 720 complementary pwm mode output protection function: complementary pwm mode output has the following protection functions. 1. register and counter miswrite prevention function with the exception of the buffe r registers, which can be rewr itten at any time, access by the cpu can be enabled or disabled for the mode registers, control registers, compare registers, and counters used in complementary pwm mode by means of bit 13 in the bus controller?s bus control register 1 (bcr1). some registers in chan nels 3 and 4 concerned are listed below: total 21 registers of tcr_3 and tcr_4; tmdr_3 and tmdr_4; tiorh_3 and tiorh_4; tiorl_3 and tiorl_4; tier_3 and tier _4; tcnt_3 and tcnt_4; tgra_3 and tgra_4; tgrb_3 and tgrb_4; toer; tocr; tgcr; tcdr; and tddr. this function enables the cpu to pr event miswriting due to the cpu runaway by disabling cpu access to the mode registers, control register, and counte rs. in access disabled state, an undefined value is read from the registers concerned, and cannot be modified. 2. halting of pwm output by external signal the 6-phase pwm output pins can be set auto matically to the high -impedance state by inputting specified external signals. ther e are four external signal input pins. see section 10.9, port output enable (poe), for details. 3. halting of pwm output when oscillator is stopped if it is detected that the clock input to this lsi has stopped, the 6-phase pwm output pins automatically go to the high-imp edance state. the pin states ar e not guaranteed when the clock is restarted. see section 4.2, function for detecting the oscillator halt, for details.
rev. 2.00, 09/04, page 247 of 720 10.5 interrupts 10.5.1 interrupts and priorities there are three kinds of mtu interrupt sour ce; tgr input capture/compare match, tcnt overflow, and tcnt underflow. each interrupt source has its own status flag and enable/disabled bit, allowing the generation of interrupt request signals to be enabled or disabled individually. when an interrupt request is generated, the corresponding status flag in tsr is set to 1. if the corresponding enable/disable bit in tier is set to 1 at this time, an interrupt is requested. the interrupt request is cleared by cl earing the status flag to 0. relative channel priorities can be changed by the interrupt controller, however the priority order within a channel is fixed. for details, s ee section 6, interrupt controller (intc). table 10.42 lists the tpu interrupt sources.
rev. 2.00, 09/04, page 248 of 720 table 10.42 mtu interrupts channel name interrupt source interrupt flag dtc activation priority 0 tgi0a tgra_0 input capture/co mpare match tgfa_0 possible high tgi0b tgrb_0 input capture/co mpare match tgfb_0 possible tgi0c tgrc_0 input capture/co mpare match tgfc_0 possible tgi0d tgrd_0 input capture/co mpare match tgfd_0 possible tci0v tcnt_0 overflow tcfv_0 not possible 1 tgi1a tgra_1 input capture/co mpare match tgfa_1 possible tgi1b tgrb_1 input capture/co mpare match tgfb_1 possible tci1v tcnt_1 overflow tcfv_1 not possible tci1u tcnt_1 underflow tcfu_1 not possible 2 tgi2a tgra_2 input capture/co mpare match tgfa_2 possible tgi2b tgrb_2 input capture/co mpare match tgfb_2 possible tci2v tcnt_2 overflow tcfv_2 not possible tci2u tcnt_2 underflow tcfu_2 not possible 3 tgi3a tgra_3 input capture/co mpare match tgfa_3 possible tgi3b tgrb_3 input capture/co mpare match tgfb_3 possible tgi3c tgrc_3 input capture/co mpare match tgfc_3 possible tgi3d tgrd_3 input capture/co mpare match tgfd_3 possible tci3v tcnt_3 overflow tcfv_3 not possible 4 tgi4a tgra_4 input capture/co mpare match tgfa_4 possible tgi4b tgrb_4 input capture/co mpare match tgfb_4 possible tgi4c tgrc_4 input capture/co mpare match tgfc_4 possible tgi4d tgrd_4 input capture/co mpare match tgfd_4 possible tci4v tcnt_4 overflow/underflow tcfv_4 possible low note: this table shows the initia l state immediately after a reset. the relative channel priorities can be changed by the interrupt controller. input capture/compar e match interrupt: an interrupt is requested if the tgie bit in tier is set to 1 when the tgf flag in tsr is set to 1 by the occurrence of a tg r input capture/compare match on a particular channel. the interrupt reques t is cleared by clearing the tgf flag to 0. the mtu has 16 input capture/compare match interrupts , four each for channels 0, 3, and 4, and two each for channels 1 and 2.
rev. 2.00, 09/04, page 249 of 720 overflow interrupt: an interrupt is requested if the tciev bit in tier is set to 1 when the tcfv flag in tsr is set to 1 by the occurrence of tcnt overflow on a channel. the interrupt request is cleared by clearing the tcfv flag to 0. the mtu has five overflow interrupts, one for each channel. underflow interrupt: an interrupt is requested if the tcieu bit in tier is set to 1 when the tcfu flag in tsr is set to 1 by the occurrence of tcnt underflow on a channel. the interrupt request is cleared by clearing th e tcfu flag to 0. the mtu has four underflow interrupts, one each for channels 1 and 2. 10.5.2 dtc activation the dtc can be activated by the tgr input capture /compare match interrupt in each channel. for details, see section 8, data transfer controller (dtc). a total of 17 mtu input capture/compare match in terrupts can be used as dtc activation sources, four each for channels 0 and 3, and two each fo r channels 1 and 2, and five for channel 4. 10.5.3 a/d converter activation the a/d converter can be activat ed by the tgra input capture/ compare match in each channel. if the ttge bit in tier is set to 1 when the tgfa flag in tsr is set to 1 by the occurrence of a tgra input capture/compare match on a particular channel, a request to start a/d conversion is sent to the a/d converter. if the mtu conversion start trigger has been selected on the a/d converter at this time, a/d conversion starts. in the mtu, a total of five tgra input capture/compare match interrupts can be used as a/d converter conversion start sour ces, one for each channel.
rev. 2.00, 09/04, page 250 of 720 10.6 operation timing 10.6.1 input/output timing tcnt count timing: figure 10.54 shows tcnt count timing in internal clock operation, and figure 10.55 shows tcnt count timing in external clock operation (normal mode), and figure 10.56 shows tcnt count timing in external clock operation (phase counting mode). tcnt tcnt input clock internal clock p n-1 n n+1 n+2 falling edge rising edge figure 10.54 count timing in internal clock operation tcnt tcnt input clock external clock p n-1 n n+1 n+2 falling edge rising edge falling edge figure 10.55 count timing in external clock operation
rev. 2.00, 09/04, page 251 of 720 p external clock tcnt input clock tcnt falling edge falling edge rising edge n-1 n n+1 figure 10.56 count timing in external clock operation (phase counting mode) output compare output timing: a compare match signal is generated in the final state in which tcnt and tgr match (the point at which the count value matched by tcnt is updated). when a compare match signal is generated, the output value set in tior is output at the output compare output pin (tioc pin). after a match between tcnt and tgr, the compare match signal is not generated until the tcnt input clock is generated. figure 10.57 shows output compare output timing (normal mode and pwm mode) and figure 10.58 shows output compare output timing (complementary pwm mode and reset synchronous pwm mode). tgr tcnt tcnt input clock n n n+1 compare match signal tioc pin p figure 10.57 output compare output timing (normal mode/pwm mode)
rev. 2.00, 09/04, page 252 of 720 p tcnt input clock tcnt n n+1 tgr compare match signal tioc pin n figure 10.58 output compare output timing (complementary pwm mode/res et synchronous pwm mode) input capture si gnal timing: figure 10.59 shows input capture signal timing. tcnt input capture input n n+1 n+2 n n+2 tgr input capture signal p figure 10.59 input capture input signal timing
rev. 2.00, 09/04, page 253 of 720 timing for counter clearing by compare match/input capture: figure 10.60 shows the timing when counter clearing on compare match is specified, and figure 10.61 shows the timing when counter clearing on input capture is specified. tcnt counter clear signal compare match signal tgr n n h'0000 p figure 10.60 counter clea r timing (compare match) tcnt counter clear signal input capture signal tgr n h'0000 n p figure 10.61 counter clea r timing (input capture)
rev. 2.00, 09/04, page 254 of 720 buffer operation timing: figures 10.63 and 10.64 show the timing in buffer operation. tgra, tgrb compare match signal tcnt tgrc, tgrd n n n n n+1 p figure 10.62 buffer operat ion timing (compare match) tgra, tgrb tcnt input capture signal tgrc, tgrd n n n n+1 n n n+1 p figure 10.63 buffer operat ion timing (input capture)
rev. 2.00, 09/04, page 255 of 720 10.6.2 interrupt signal timing tgf flag setting timing in case of compare match: figure 10.64 shows the timing for setting of the tgf flag in tsr on compare match, and tgi interrupt request signal timing. tgr tcnt tcnt input clock n n n+1 compare match signal tgf flag tgi interrupt p figure 10.64 tgi interrupt timing (compare match) tgf flag setting timing in case of input capture: figure 10.65 shows the timing for setting of the tgf flag in tsr on input capture, and tgi interrupt request signal timing. tgr tcnt input capture signal n n tgf flag tgi interrupt p figure 10.65 tgi interrupt timing (input capture)
rev. 2.00, 09/04, page 256 of 720 tcfv flag/tcfu flag setting timing: figure 10.66 shows the timing for setting of the tcfv flag in tsr on overflow, and tciv interrupt request signal timing. figure 10.67 shows the timing for setting of the tcfu flag in tsr on underflow, and tciu interrupt request signal timing. overflow signal tcnt (overflow) tcnt input clock h'ffff h'0000 tcfv flag tciv interrupt p figure 10.66 tciv in terrupt setting timing underflow signal tcnt (underflow) tcnt input clock h'0000 h'ffff tcfu flag tciu interrupt p figure 10.67 tciu in terrupt setting timing
rev. 2.00, 09/04, page 257 of 720 status flag clearing timing: after a status flag is read as 1 by the cpu, it is cleared by writing 0 to it. when the dtc is activated, the flag is cleared automatically. figure 10.68 shows the timing for status flag clearing by the cpu, an d figure 10.69 shows the timing for status flag clearing by the dtc. status flag write signal address tsr address interrupt request signal tsr write cycle t1 t2 p figure 10.68 timing for stat us flag clearing by the cpu interrupt request signal status flag address source address dtc read cycle t1 t2 destination address t1 t2 dtc write cycle p figure 10.69 timing for status flag clearing by dtc activation
rev. 2.00, 09/04, page 258 of 720 10.7 usage notes 10.7.1 module standby mode setting mtu operation can be disabled or enabled using the module standby register. the initial setting is for mtu operation to be halted. register access is enabled by clearing module standby mode. for details, refer to section 24, power-down modes. 10.7.2 input clock restrictions the input clock pulse width must be at least 1.5 st ates in the case of single-edge detection, and at least 2.5 states in the case of both-edge detecti on. the tpu will not operat e properly at narrower pulse widths. in phase counting mode, the phase difference and ove rlap between the two inpu t clocks must be at least 1.5 states, and the pulse width must be at least 2.5 states. figure 10.43 shows the input clock conditions in phase counting mode. overlap phase differ- ence phase differ- ence overlap tclka (tclkc) tclkb (tclkd) pulse width pulse width pulse width pulse width notes: phase difference and overlap pulse width : 1.5 states or more : 2.5 states or more figure 10.70 phase difference, overlap, and pulse width in phase counting mode
rev. 2.00, 09/04, page 259 of 720 10.7.3 caution on period setting when counter clearing on compare match is set, tcnt is cleared in the final state in which it matches the tgr value (the point at which the count value matched by tcnt is updated). consequently, the actual counter frequency is given by the following formula: f = p (n + 1) where f: counter frequency p : peripheral clock operating frequency n: tgr set value 10.7.4 contention between tc nt write and clear operations if the counter clear signal is generated in the t2 state of a tcnt write cy cle, tcnt clearing takes precedence and the tcnt write is not performed. figure 10.71 shows the timing in this case. counter clear signal write signal address p tcnt address tcnt tcnt write cycle t1 t2 n h'0000 figure 10.71 contention betwee n tcnt write and clear operations
rev. 2.00, 09/04, page 260 of 720 10.7.5 contention be tween tcnt write and increment operations if incrementing occurs in the t2 state of a tcnt write cycle, the tcnt write takes precedence and tcnt is not incremented. figure 10.72 shows the timing in this case. tcnt input clock write signal address p tcnt address tcnt tcnt write cycle t1 t2 nm tcnt write data figure 10.72 contention between tc nt write and increment operations
rev. 2.00, 09/04, page 261 of 720 10.7.6 contention between tgr write and compare match when a compare match occurs in the t2 state of a tgr write cycle, the tgr write is executed and the compare match signal is generated. figure 10.73 shows the timing in this case. compare match signal write signal address p tgr address tcnt tgr write cycle t1 t2 nm tgr write data tgr n n+1 figure 10.73 contention betw een tgr write and compare match
rev. 2.00, 09/04, page 262 of 720 10.7.7 contention between buffer register write and compare match if a compare match occurs in the t2 state of a tgr write cycle, the data that is transferred to tgr by the buffer operation differs depending on channel 0 and channels 3 and 4: data on channel 0 is that after write, and on channels 3 and 4, before write. figures 10.74 and 10.75 show the timing in this case. compare match buffer signal compare match signal write signal address p buffer register address buffer register tgr write cycle t1 t2 m tgr nm buffer register write data figure 10.74 contention between buffer re gister write and compare match (channel 0)
rev. 2.00, 09/04, page 263 of 720 p address write signal compare match signal compare match buffer signal tgr write cycle t1 t2 buffer register address n n m buffer register write data buffer register tgr figure 10.75 contention between bu ffer register write and compare match (channels 3 and 4)
rev. 2.00, 09/04, page 264 of 720 10.7.8 contention between tgr read and input capture if an input capture signal is generated in the t1 stat e of a tgr read cycle, the data that is read will be that in the buffer after input capture transfer. figure 10.76 shows the timing in this case. p address read signal input capture signal tgr read cycle t1 t2 tgr address m m tgr internal data bus x figure 10.76 contention between tgr read and input capture
rev. 2.00, 09/04, page 265 of 720 10.7.9 contention between tgr write and input capture if an input capture signal is generated in the t2 state of a tgr write cycle, the input capture operation takes precedence and the wr ite to tgr is not performed. figure 10.77 shows the timing in this case. input capture signal write signal address p tcnt tgr write cycle t1 t2 m tgr m tgr address figure 10.77 contention betw een tgr write and input capture
rev. 2.00, 09/04, page 266 of 720 10.7.10 contention between buffer register write and input capture if an input capture signal is generated in the t2 st ate of a buffer register write cycle, the buffer operation takes precedence and the write to the buffer register is not performed. figure 10.78 shows the timing in this case. input capture signal write signal address p tcnt buffer register write cycle t1 t2 n tgr n m m buffer register buffer register address figure 10.78 contention between bu ffer register write and input capture 10.7.11 tcnt2 write and overflow/underflow contention in cascade connection with timer counters tcnt1 and tcnt2 in a cas cade connection, when a contention occurs during tcnt_1 count (during a tcnt_2 overflow/underflow) in the t 2 state of the tcnt_2 write cycle, the write to tcnt_2 is conducted, and the tcnt_1 count signal is disabled. at this point, if there is match with tgra_1 and th e tcnt_1 value, a compare signal is issued. furthermore, when the tcnt_1 count clock is sel ected as the input capture source of channel 0, tgra_0 to d_0 carry out the input capture operation. in addition, when the compare match/input capture is selected as the input capture sour ce of tgrb_1, tgrb_1 carries out input capture operation. the timing is shown in figure 10.79. for cascade connections, be sure to synchronize settings for channels 1 and 2 when setting tcnt clearing.
rev. 2.00, 09/04, page 267 of 720 t1 t1 h'fffe h'ffff n n + 1 h'ffff m m n p qp m disabled tcnt_2 write data tcnt_2 address tcnt write cycle p address write signal tcnt_2 tgr2a_2 to tgr2b_2 ch2 compare- match signal a/b tcnt_1 input clock tcnt_1 tgra_1 ch1 compare- match signal a tgrb_1 ch1 input capture signal b tcnt_0 tgra_0 to tgrd_0 ch0 input capture signal a to d figure 10.79 tcnt_2 write and overfl ow/underflow contention with cascade connection
rev. 2.00, 09/04, page 268 of 720 10.7.12 counter value during co mplementary pwm mode stop when counting operation is stopped with tcnt_3 and tcnt_4 in complementary pwm mode, tcnt_3 has the timer dead time register (tddr) value, and tcnt_4 is set to h'0000. when restarting complementary pwm mode, coun ting begins automatically from the initialized state. this explanatory diagram is shown in figure 10.80. when counting begins in another operating mode, be sure that tcnt_3 and tcnt_4 are set to the initial values. tgra_3 tcdr tddr h'0000 tcnt_3 tcnt_4 complementary pwm mode operation complementary pwm mode operation counter operation stop complementary pmw restart figure 10.80 counter value during complementary pwm mode stop 10.7.13 buffer operation setting in complementary pwm mode in complementary pwm mode, conduct rewrites by buffer operation for the pwm cycle setting register (tgra_3), timer cycle data register (tcdr), and duty setting registers (tgrb_3, trga_4, and tgrb_4). in complementary pwm mode, channel 3 and chan nel 4 buffers operate in accordance with bit settings bfa and bfb of tmdr_3. when tmdr_3?s bfa bit is set to 1, tgrc_3 functions as a buffer register for tgra_3. at the same time, tgrc_4 functions as the buffer register for trga_4, while the tcbr functions as the tcdr?s buffer register.
rev. 2.00, 09/04, page 269 of 720 10.7.14 reset sync pwm mode buffer operation and compare match flag when setting buffer operation for reset sync pwm mode, set the bfa and bfb bits of tmdr_4 to 0. the tioc4c pin will be unable to produce its waveform output if the bfa bit of tmdr_4 is set to 1. in reset sync pwm mode, the channel 3 and channel 4 buffers operate in accordance with the bfa and bfb bit settings of tmdr_3. for example, if the bfa bit of tmdr_3 is set to 1, tgrc_3 functions as the buffer register for tgra_3. at the same time, tgrc_4 functions as the buffer register for trga_4. the tgfc bit and tgfd bit of tsr_3 and tsr_4 are not set when tgrc_3 and tgrd_3 are operating as buffer registers. figure 10.81 shows an example of operations for tgr_3, tgr_4, tioc3, and tioc4, with tmdr_3?s bfa and bfb bits set to 1, and tmdr_4?s bfa and bfb bits set to 0. tgra_3 tgrc_3 tgrb_3, tgra_4, tgrb_4 tgrd_3, tgrc_4, tgrd_4 h'0000 tioc3a tioc3b tioc3d tioc4a tioc4c tioc4b tioc4d tgfc tgfd tgra_3, tgrc_3 tgrb_3, tgrd_3, tgra_4, tgrc_4, tgrb_4, tgrd_4 buffer transfer with compare match a3 tcnt3 not set not set point a point b figure 10.81 buffer operation and compa re-match flags in reset sync pwm mode
rev. 2.00, 09/04, page 270 of 720 10.7.15 overflow flags in reset sync pwm mode when set to reset sync pwm mode, tcnt_3 and tcnt_4 start counting when the cst3 bit of tstr is set to 1. at this point, tcnt_4?s count clock source and count edge obey the tcr_3 setting. in reset sync pwm mode, with cycle register tgra_3?s set value at h' ffff, when specifying tgr3a compare-match for the count er clear source, tcnt_3 and tcnt_4 count up to h'ffff, then a compare-match occurs with tgra_3, and tcnt_3 and tcnt_4 are both cleared. at this point, tsr?s overflow flag tcfv bit is not set. figure 10.82 shows a tcfv bit operation example in reset sync pwm mode with a set value for cycle register tgra_3 of h'ffff, when a tgra _3 compare-match has been specified without synchronous setting for the counter clear source. tgra_3 (h'ffff) h'0000 tcfv_3 tcfv_4 tcnt_3 = tcnt_4 counter cleared by compare match 3a not set not set figure 10.82 reset sync pwm mode overflow flag
rev. 2.00, 09/04, page 271 of 720 10.7.16 contention between overflo w/underflow and counter clearing if overflow/underflow and counter clearing occur simultaneously, the tcfv/tcfu flag in tsr is not set and tcnt clearing takes precedence. figure 10.83 shows the operation timing when a tgr compare match is sp ecified as the clearing source, and when h'ff ff is set in tgr. counter clear signal tcnt tcnt input clock p h'ffff h'0000 tgf tcfv disabled figure 10.83 contention betwee n overflow and counter clearing
rev. 2.00, 09/04, page 272 of 720 10.7.17 contention between tcnt write and overflow/underflow if there is an up-count or down-count in the t2 state of a tcnt write cycle, and overflow/underflow occurs, the tcnt write takes precedence and the tcfv/tcfu flag in tsr is not set. figure 10.84 shows the operation timing when there is contention between tcnt write and overflow. write signal address p tcnt address tcnt tcnt write cycle t1 t2 h'ffff m tcnt write data tcfv flag figure 10.84 contention be tween tcnt write and overflow
rev. 2.00, 09/04, page 273 of 720 10.7.18 cautions on transition from normal operation or pwm mode 1 to reset- synchronous pwm mode when making a transition from channel 3 or 4 normal operation or pwm mode 1 to reset- synchronous pwm mode, if the counter is halted with the output pins (tioc3b, tioc3d, tioc4a, tioc4c, tioc4b, tioc4d) in the high-imp edance state, followed by the transition to reset-synchronous pwm mode and operation in that mode, the initial pin output will not be correct. when making a transition from normal operation to reset-synchronous pwm mode, write h'11 to registers tiorh_3, tiorl_3, tiorh_4, and tiorl_4 to initialize the output pins to low level output, then set an initial register value of h'00 before making the mode transition. when making a transition from pwm mode 1 to reset-synchronous pwm mode, first switch to normal operation, then initialize the output pins to low level output and set an initial register value of h'00 before making the transition to reset-synchronous pwm mode. 10.7.19 output level in complementary pw m mode and reset-synchronous pwm mode when channels 3 and 4 are in complementary pwm mode or reset-synchronous pwm mode, the pwm waveform output level is set with the olsp and olsn bits in the timer output control register (tocr). in the case of complementary pwm mode or reset-synchronous pwm mode, tior should be set to h'00. 10.7.20 interrupts in module standby mode if module standby mode is entered when an interrupt has been requested, it will not be possible to clear the cpu interrupt source or the dtc activation source. in terrupts should therefore be disabled before entering module standby mode. 10.7.21 simultaneous input capture of tc nt-1 and tcnt-2 in cascade connection when cascade-connected timer counters (tcnt- 1 and tcnt-2) are operated, cascade values cannot be captured even if input capture is executed simultaneously with tioc1a or tioc1b and tioc2a or tioc2b.
rev. 2.00, 09/04, page 274 of 720 10.8 mtu output pin initialization 10.8.1 operating modes the mtu has the following six operating modes. waveform output is possible in all of these modes. ? normal mode (channels 0 to 4) ? pwm mode 1 (channels 0 to 4) ? pwm mode 2 (channels 0 to 2) ? phase counting modes 1?4 (channels 1 and 2) ? complementary pwm mode (channels 3 and 4) ? reset-synchronous pwm mode (channels 3 and 4) the mtu output pin initialization method for each of these modes is described in this section. 10.8.2 reset start operation the mtu output pins (tioc*) are initialized low by a reset or in standby mode. since mtu pin function selection is performed by the pin functio n controller (pfc), when the pfc is set, the mtu pin states at that point are output to the ports. when mtu output is selected by the pfc immediately after a reset, the mtu output initial level, low, is output directly at the port. when the active level is low, the system will operate at this point, and therefore the pfc setting should be made after initialization of the mtu output pins is completed. note: channel number and port notation are substituted for *.
rev. 2.00, 09/04, page 275 of 720 10.8.3 operation in case of re-setting due to error during operation, etc. if an error occurs during mtu operation, mtu output should be cut by the system. cutoff is performed by switching the pin output to port output with the pfc and outputting the inverse of the active level. for large-current pins, output can also be cut by hardware, using port output enable (poe). the pin initialization procedures for re-setting due to an error during operation, etc., and the procedures for restarting in a different mode after re-setting, are shown below. the mtu has six operating modes, as stated above. there are thus 36 mode transition combinations, but some transitions are not available with certain channel and mode combinations. possible mode transition combinations are shown in table 10.43. table 10.43 mode transition combinations after before normal pwm1 pwm2 pcm cpwm rpwm normal (1) (2) (3) (4) (5) (6) pwm1 (7) (8) (9) (10) (11) (12) pwm2 (13) (14) (15) (16) none none pcm (17) (18) (19) (20) none none cpwm (21) (22) none none (23) (24) (25) rpwm (26) (27) none none (28) (29) [legend] normal: normal mode pwm1: pwm mode 1 pwm2: pwm mode 2 pcm: phase counting modes 1?4 cpwm: complementary pwm mode rpwm: reset-synchronous pwm mode the above abbreviations are used in some places in following descriptions.
rev. 2.00, 09/04, page 276 of 720 10.8.4 overview of initialization procedures and mode transitions in case of error during operation, etc. ? when making a transition to a mode (normal, pwm1, pwm2, pcm) in which the pin output level is selected by the timer i/o control register (tior) setting, initialize the pins by means of a tior setting. ? in pwm mode 1, since a waveform is not output to the tioc*b (tioc *d) pin, setting tior will not initialize the pins. if initialization is re quired, carry it out in normal mode, then switch to pwm mode 1. ? in pwm mode 2, since a waveform is not output to the cycle register pin, setting tior will not initialize the pins. if initialization is required, carry it out in normal mode, then switch to pwm mode 2. ? in normal mode or pwm mode 2, if tgrc an d tgrd operate as buffer registers, setting tior will not initialize the buffer register pins. if initialization is required, clear buffer mode, carry out initialization, then set buffer mode again. ? in pwm mode 1, if either tgrc or tgrd operates as a buffer register, setting tior will not initialize the tgrc pin. to initialize the tgrc pin, clear buffer mode, carry out initialization, then set buffer mode again. ? when making a transition to a mode (cpwm, rpwm) in which the pin output level is selected by the timer output control register (tocr) setting, switch to normal mode and perform initialization with tior, then restore tior to its initial value, and temporarily disable channel 3 and 4 output with the timer output master enable register (toer). then operate the unit in accordance with the mode setting procedure (tocr sett ing, tmdr setting, toer setting). pin initialization procedures are described below fo r the numbered combinations in table 10.43. the active level is assumed to be low. note: channel number is substituted for * indicated in this article.
rev. 2.00, 09/04, page 277 of 720 operation when error occurs during normal mode operation, and op eration is restarted in normal mode: figure 10.85 shows an explanatory diag ram of the case where an error occurs in normal mode and operation is restarted in normal mode after re-setting. 1 reset 2 tmdr (normal) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) mtu module output tioc*a tioc*b port output pen pen n=0 to 15 high-z high-z figure 10.85 error occurrence in norm al mode, recovery in normal mode 1. after a reset, mtu output is low and ports are in the hi gh-impedance state. 2. after a reset, the tmdr setting is for normal mode. 3. for channels 3 and 4, enable output with toer before initializing the pins with tior. 4. initialize the pins with tior. (the example shows initial high output, with low output on compare-match occurrence.) 5. set mtu output with the pfc. 6. the count operation is started by tstr. 7. output goes low on compare-match occurrence. 8. an error occurs. 9. set port output with the pfc and output the inverse of the active level. 10. the count operation is stopped by tstr. 11. not necessary when restarting in normal mode. 12. initialize the pins with tior. 13. set mtu output with the pfc. 14. operation is restarted by tstr.
rev. 2.00, 09/04, page 278 of 720 operation when error occurs during normal mode operation, and op eration is restarted in pwm mode 1: figure 10.86 shows an explanatory diag ram of the case where an error occurs in normal mode and operation is restarted in pwm mode 1 after re-setting. 1 reset 2 tmdr (normal) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pwm1) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) mtu module output tioc*a tioc*b port output pen pen  not initialized (tioc*b) n=0 to 15 high-z high-z figure 10.86 error occurrence in no rmal mode, recovery in pwm mode 1 1 to 10 are the same as in figure 10.85. 11. set pwm mode 1. 12. initialize the pins with tior. (in pwm mode 1, the tioc*b side is not initialized. if initialization is required, initialize in norm al mode, then switch to pwm mode 1.) 13. set mtu output with the pfc. 14. operation is restarted by tstr.
rev. 2.00, 09/04, page 279 of 720 operation when error occurs during normal mode operation, and op eration is restarted in pwm mode 2: figure 10.87 shows an explanatory diag ram of the case where an error occurs in normal mode and operation is restarted in pwm mode 2 after re-setting. 1 reset 2 tmdr (normal) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pwm2) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) mtu module output tioc*a tioc*b port output pen pen  not initialized (cycle register) n=0 to 15 high-z high-z figure 10.87 error occurrence in no rmal mode, recovery in pwm mode 2 1 to 10 are the same as in figure 10.85. 11. set pwm mode 2. 12. initialize the pins with tior. (in pwm mode 2, the cycle register pins are not initialized. if initialization is required, initialize in norm al mode, then switch to pwm mode 2.) 13. set mtu output with the pfc. 14. operation is restarted by tstr. note: pwm mode 2 can only be set for channels 0?2, and therefore toer setting is not necessary.
rev. 2.00, 09/04, page 280 of 720 operation when error occurs during normal mode operation, and op eration is restarted in phase counting mode: figure 10.88 shows an explanatory diagram of the case where an error occurs in normal mode and operation is restar ted in phase counting mode after re-setting. 1 reset 2 tmdr (normal) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pcm) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) mtu module output tioc*a tioc*b port output pen pen n=0 to 15 high-z high-z figure 10.88 error occurrence in normal mode, recovery in phase counting mode 1 to 10 are the same as in figure 10.85. 11. set phase counting mode. 12. initialize the pins with tior. 13. set mtu output with the pfc. 14. operation is restarted by tstr. note: phase counting mode can only be set for ch annels 1 and 2, and therefore toer setting is not necessary.
rev. 2.00, 09/04, page 281 of 720 operation when error occurs during normal mode operation, and op eration is restarted in complementary pwm mode: figure 10.89 shows an explanat ory diagram of the case where an error occurs in normal mode and operation is restarted in complementary pwm mode after re- setting. 1 reset 2 tmdr (normal) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tior (0 init 0 out) 12 tior ( disabled ) 13 toer (0) 14 tocr 15 tmdr (cpwm) (16) toer (1) (17) pfc (mtu) (18) tstr (1) mtu module output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 high-z high-z high-z figure 10.89 error occurrence in normal mode, recovery in complementary pwm mode 1 to 10 are the same as in figure 10.85. 11. initialize the normal mode waveform generation section with tior. 12. disable operation of the normal mode waveform generation section with tior. 13. disable channel 3 and 4 output with toer. 14. select the complementary pwm output level and cyclic output enabling/disabling with tocr. 15. set complementary pwm. 16. enable channel 3 and 4 output with toer. 17. set mtu output with the pfc. 18. operation is restarted by tstr.
rev. 2.00, 09/04, page 282 of 720 operation when error occurs during normal mode operation, and op eration is restarted in reset-synchronous pwm mode: figure 10.90 shows an explan atory diagram of the case where an error occurs in normal mode and operation is restarted in reset-synchronous pwm mode after re-setting. 1 reset 2 tmdr (normal) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tior (0 init 0 out) 12 tior ( disabled ) 13 toer (0) 14 tocr 15 tmdr (cpwm) 16 toer (1) 17 pfc (mtu) 18 tstr (1) mtu module output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 high-z high-z high-z figure 10.90 error occurrence in normal mode, recovery in reset-synchronous pwm mode 1 to 13 are the same as in figure 10.89. 14. select the reset-synchronous pwm output level and cyclic output enabling/disabling with tocr. 15. set reset-synchronous pwm. 16. enable channel 3 and 4 output with toer. 17. set mtu output with the pfc. 18. operation is restarted by tstr.
rev. 2.00, 09/04, page 283 of 720 operation when error occurs during pwm mo de 1 operation, and operation is restarted in normal mode: figure 10.91 shows an explanatory diag ram of the case where an error occurs in pwm mode 1 and operation is restar ted in normal mode after re-setting. 1 reset 2 tmdr (pwm1) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) mtu module output tioc*a tioc*b port output pen pen  not initialized (tioc*b) n=0 to 15 high-z high-z figure 10.91 error occurrence in pwm mode 1, recovery in normal mode 1. after a reset, mtu output is low and ports are in the hi gh-impedance state. 2. set pwm mode 1. 3. for channels 3 and 4, enable output with toer before initializing the pins with tior. 4. initialize the pins with tior. (the example shows initial high output, with low output on compare-match occurrence. in pwm mode 1, the tioc*b side is not initialized.) 5. set mtu output with the pfc. 6. the count operation is started by tstr. 7. output goes low on compare-match occurrence. 8. an error occurs. 9. set port output with the pfc and output the inverse of the active level. 10. the count operation is stopped by tstr. 11. set normal mode. 12. initialize the pins with tior. 13. set mtu output with the pfc. 14. operation is restarted by tstr.
rev. 2.00, 09/04, page 284 of 720 operation when error occurs during pwm mo de 1 operation, and operation is restarted in pwm mode 1: figure 10.92 shows an explanatory diag ram of the case where an error occurs in pwm mode 1 and operation is restar ted in pwm mode 1 after re-setting. 1 reset 2 tmdr (pwm1) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pwm1) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) mtu module output tioc*a tioc*b port output pen pen  not initialized (tioc*b)  not initialized (tioc*b) n=0 to 15 high-z high-z figure 10.92 error occurrence in pw m mode 1, recovery in pwm mode 1 1 to 10 are the same as in figure 10.91. 11. not necessary when restarting in pwm mode 1. 12. initialize the pins with tior. (in pwm mode 1, the tioc*b side is not initialized.) 13. set mtu output with the pfc. 14. operation is restarted by tstr.
rev. 2.00, 09/04, page 285 of 720 operation when error occurs during pwm mo de 1 operation, and operation is restarted in pwm mode 2: figure 10.93 shows an explanatory diag ram of the case where an error occurs in pwm mode 1 and operation is restar ted in pwm mode 2 after re-setting. 1 reset 2 tmdr (pwm1) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pwm2) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) mtu module output tioc*a tioc*b port output pen pen  not initialized (tioc*b)  not initialized (cycle register) n=0 to 15 high-z high-z figure 10.93 error occurrence in pw m mode 1, recovery in pwm mode 2 1 to 10 are the same as in figure 10.91. 11. set pwm mode 2. 12. initialize the pins with tior. (in pwm mode 2, the cycle register pins are not initialized.) 13. set mtu output with the pfc. 14. operation is restarted by tstr. note: pwm mode 2 can only be set for channels 0?2, and therefore toer setting is not necessary.
rev. 2.00, 09/04, page 286 of 720 operation when error occurs during pwm mo de 1 operation, and operation is restarted in phase counting mode: figure 10.94 shows an explanatory diagram of the case where an error occurs in pwm mode 1 and operation is restarted in phase counting mode after re-setting. 1 reset 2 tmdr (pwm1) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pcm) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) mtu module output tioc*a tioc*b port output pen pen  not initialized (tioc*b) n=0 to 15 high-z high-z figure 10.94 error occurrence in pwm mode 1, recovery in phase counting mode 1 to 10 are the same as in figure 10.91. 11. set phase counting mode. 12. initialize the pins with tior. 13. set mtu output with the pfc. 14. operation is restarted by tstr. note: phase counting mode can only be set for ch annels 1 and 2, and therefore toer setting is not necessary.
rev. 2.00, 09/04, page 287 of 720 operation when error occurs during pwm mo de 1 operation, and operation is restarted in complementary pwm mode: figure 10.95 shows an explan atory diagram of the case where an error occurs in pwm mode 1 and operation is restarted in complementary pwm mode after re- setting. 1 reset 2 tmdr (pwm1) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 tior (0 init 0 out) 13 tior ( disabled ) 14 toer (0) 15 tocr 16 tmdr (cpwm) 17 toer (1) 18 pfc (mtu) 19 tstr (1) mtu module output tioc3a tioc3b tioc3d port output pe9 pe8 pe11  not initialized (tioc3b)  not initialized (tioc3d) high-z high-z high-z figure 10.95 error occurrence in pwm mode 1, recovery in complementary pwm mode 1 to 10 are the same as in figure 10.91. 11. set normal mode for initialization of the normal mode waveform generation section. 12. initialize the pwm mode 1 waveform generation section with tior. 13. disable operation of the pwm mode 1 waveform generation section with tior. 14. disable channel 3 and 4 output with toer. 15. select the complementary pwm output level and cyclic output enabling/disabling with tocr. 16. set complementary pwm. 17. enable channel 3 and 4 output with toer. 18. set mtu output with the pfc. 19. operation is restarted by tstr.
rev. 2.00, 09/04, page 288 of 720 operation when error occurs during pwm mo de 1 operation, and operation is restarted in reset-synchronous pwm mode: figure 10.96 shows an explan atory diagram of the case where an error occurs in pwm mode 1 and operation is restarted in reset-synchronous pwm mode after re-setting. 1 reset 2 tmdr (pwm1) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 tior (0 init 0 out) 13 tior ( disabled ) 14 toer (0) 15 tocr 16 tmdr (rpwm) 17 toer (1) 18 pfc (mtu) 19 tstr (1) mtu module output tioc3a tioc3b tioc3d port output pe9 pe8 pe11  not initialized (tioc3b)  not initialized (tioc3d) high-z high-z high-z figure 10.96 error occurrence in pwm mo de 1, recovery in reset-synchronous pwm mode 1 to 14 are the same as in figure 10.95. 15. select the reset-synchronous pwm output level and cyclic output enabling/disabling with tocr. 16. set reset-synchronous pwm. 17. enable channel 3 and 4 output with toer. 18. set mtu output with the pfc. 19. operation is restarted by tstr.
rev. 2.00, 09/04, page 289 of 720 operation when error occurs during pwm mo de 2 operation, and operation is restarted in normal mode: figure 10.97 shows an explanatory diag ram of the case where an error occurs in pwm mode 2 and operation is restar ted in normal mode after re-setting. 1 reset 2 tmdr (pwm2) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (normal) 11 tior (1 init 0 out) 12 pfc (mtu) 13 tstr (1) mtu module output tioc*a tioc*b port output pen pen  not initialized (cycle register) n=0 to 15 high-z high-z figure 10.97 error occurrence in pwm mode 2, recovery in normal mode 1. after a reset, mtu output is low and ports are in the hi gh-impedance state. 2. set pwm mode 2. 3. initialize the pins with tior. (the example shows initial high output, with low output on compare-match occurrence. in pwm mode 2, the cycle register pins are not initialized. in the example, tioc *a is the cycle register.) 4. set mtu output with the pfc. 5. the count operation is started by tstr. 6. output goes low on compare-match occurrence. 7. an error occurs. 8. set port output with the pfc and output the inverse of the active level. 9. the count operation is stopped by tstr. 10. set normal mode. 11. initialize the pins with tior. 12. set mtu output with the pfc. 13. operation is restarted by tstr.
rev. 2.00, 09/04, page 290 of 720 operation when error occurs during pwm mo de 2 operation, and operation is restarted in pwm mode 1: figure 10.98 shows an explanatory diag ram of the case where an error occurs in pwm mode 2 and operation is restar ted in pwm mode 1 after re-setting. 1 reset 2 tmdr (pwm2) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (pwm1) 11 tior (1 init 0 out) 12 pfc (mtu) 13 tstr (1) mtu module output tioc*a tioc*b port output pen pen  not initialized (tioc*b)  not initialized (cycle register) n=0 to 15 high-z high-z figure 10.98 error occurrence in pw m mode 2, recovery in pwm mode 1 1 to 9 are the same as in figure 10.97. 10. set pwm mode 1. 11. initialize the pins with tior. (in pwm mode 1, the tioc*b side is not initialized.) 12. set mtu output with the pfc. 13. operation is restarted by tstr.
rev. 2.00, 09/04, page 291 of 720 operation when error occurs during pwm mo de 2 operation, and operation is restarted in pwm mode 2: figure 10.99 shows an explanatory diag ram of the case where an error occurs in pwm mode 2 and operation is restar ted in pwm mode 2 after re-setting. 1 reset 2 tmdr (pwm2) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (pwm2) 11 tior (1 init 0 out) 12 pfc (mtu) 13 tstr (1) mtu module output tioc*a tioc*b port output pen pen  not initialized (cycle register)  not initialized (cycle register) n=0 to 15 high-z high-z figure 10.99 error occurrence in pw m mode 2, recovery in pwm mode 2 1 to 9 are the same as in figure 10.97. 10. not necessary when restarting in pwm mode 2. 11. initialize the pins with tior. (in pwm mode 2, the cycle register pins are not initialized.) 12. set mtu output with the pfc. 13. operation is restarted by tstr.
rev. 2.00, 09/04, page 292 of 720 operation when error occurs during pwm mo de 2 operation, and operation is restarted in phase counting mode: figure 10.100 shows an explanat ory diagram of the case where an error occurs in pwm mode 2 and operation is restarted in phase counting mode after re-setting. 1 reset 2 tmdr (pwm2) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (pcm) 11 tior (1 init 0 out) 12 pfc (mtu) 13 tstr (1) mtu module output tioc*a tioc*b port output pen pen  not initialized (cycle register) n=0 to 15 high-z high-z figure 10.100 error occurrence in pwm mo de 2, recovery in phase counting mode 1 to 9 are the same as in figure 10.97. 10. set phase counting mode. 11. initialize the pins with tior. 12. set mtu output with the pfc. 13. operation is restarted by tstr.
rev. 2.00, 09/04, page 293 of 720 operation when error occurs during phase counting mode operation, and operation is restarted in normal mode: figure 10.101 shows an explanat ory diagram of the case where an error occurs in phase counting mode and operation is restarted in normal mode after re-setting. 1 reset 2 tmdr (pcm) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (normal) 11 tior (1 init 0 out) 12 pfc (mtu) 13 tstr (1) mtu module output tioc*a tioc*b port output pen pen n=0 to 15 high-z high-z figure 10.101 error occurrence in phase counting mode, recovery in normal mode 1. after a reset, mtu output is low and ports are in the hi gh-impedance state. 2. set phase counting mode. 3. initialize the pins with tior. (the example shows initial high output, with low output on compare-match occurrence.) 4. set mtu output with the pfc. 5. the count operation is started by tstr. 6. output goes low on compare-match occurrence. 7. an error occurs. 8. set port output with the pfc and output the inverse of the active level. 9. the count operation is stopped by tstr. 10. set in normal mode. 11. initialize the pins with tior. 12. set mtu output with the pfc. 13. operation is restarted by tstr.
rev. 2.00, 09/04, page 294 of 720 operation when error occurs during phase counting mode operation, and operation is restarted in pwm mode 1: figure 10.102 shows an explanat ory diagram of the case where an error occurs in phase counting mode and operation is restarted in pwm mode 1 after re-setting. 1 reset 2 tmdr (pcm) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (pwm1) 11 tior (1 init 0 out) 12 pfc (mtu) 13 tstr (1) mtu module output tioc*a tioc*b port output pen pen  not initialized (tioc*b) n=0 to 15 high-z high-z figure 10.102 error occurrence in phase counting mode, recovery in pwm mode 1 1 to 9 are the same as in figure 10.101. 10. set pwm mode 1. 11. initialize the pins with tior. (in pwm mode 1, the tioc *b side is not initialized.) 12. set mtu output with the pfc. 13. operation is restarted by tstr.
rev. 2.00, 09/04, page 295 of 720 operation when error occurs during phase counting mode operation, and operation is restarted in pwm mode 2: figure 10.103 shows an explanat ory diagram of the case where an error occurs in phase counting mode and operation is restarted in pwm mode 2 after re-setting. 1 reset 2 tmdr (pcm) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (pwm2) 11 tior (1 init 0 out) 12 pfc (mtu) 13 tstr (1) mtu module output tioc*a tioc*b port output pen pen n=0 to 15 high-z high-z  not initialized (cycle register) figure 10.103 error occurrence in phase counting mode, recovery in pwm mode 2 1 to 9 are the same as in figure 10.101. 10. set pwm mode 2. 11. initialize the pins with tior. (in pwm mode 2, the cycle register pins are not initialized.) 12. set mtu output with the pfc. 13. operation is restarted by tstr.
rev. 2.00, 09/04, page 296 of 720 operation when error occurs during phase counting mode operation, and operation is restarted in phase counting mode: figure 10.104 shows an explanatory diagram of the case where an error occurs in phase counting mode and operation is restarted in phase counting mode after re-setting. 1 reset 2 tmdr (pcm) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (pcm) 11 tior (1 init 0 out) 12 pfc (mtu) 13 tstr (1) mtu module output tioc*a tioc*b port output pen pen n=0 to 15 high-z high-z figure 10.104 error occurrence in ph ase counting mode, recovery in phase counting mode 1 to 9 are the same as in figure 10.101. 10. not necessary when restar ting in phase counting mode. 11. initialize the pins with tior. 12. set mtu output with the pfc. 13. operation is restarted by tstr.
rev. 2.00, 09/04, page 297 of 720 operation when error occurs during complementary pwm mode operation, and operation is restarted in normal mode: figure 10.105 shows an explanatory diagram of the case where an error occurs in complementary pwm mode and oper ation is restarted in normal mode after re-setting. 1 reset 2 tocr 3 tmdr (cpwm) 5 pfc (mtu) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) mtu module output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 high-z high-z high-z figure 10.105 error o ccurrence in complementary pwm mode, recovery in normal mode 1. after a reset, mtu output is low and ports are in the hi gh-impedance state. 2. select the complementary pwm output level and cyclic output enabling/disabling with tocr. 3. set complementary pwm. 4. enable channel 3 and 4 output with toer. 5. set mtu output with the pfc. 6. the count operation is started by tstr. 7. the complementary pwm waveform is output on compare-match occurrence. 8. an error occurs. 9. set port output with the pfc and output the inverse of the active level. 10. the count operation is stopped by tstr. (mtu output becomes the complementary pwm output initial value.) 11. set normal mode. (mtu output goes low.) 12. initialize the pins with tior. 13. set mtu output with the pfc. 14. operation is restarted by tstr.
rev. 2.00, 09/04, page 298 of 720 operation when error occurs during complementary pwm mode operation, and operation is restarted in pwm mode 1: figure 10.106 shows an explanatory diagram of the case where an error occurs in complementary pwm mode and op eration is restarted in pwm mode 1 after re-setting. 1 reset 2 tocr 3 tmdr (cpwm) 5 pfc (mtu) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pwm1) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) mtu module output tioc3a tioc3b tioc3d port output pe9 pe8 pe11  not initialized (tioc3b)  not initialized (tioc3d) high-z high-z high-z figure 10.106 error occurrence in co mplementary pwm mode, recovery in pwm mode 1 1 to 10 are the same as in figure 10.105. 11. set pwm mode 1. (mtu output goes low.) 12. initialize the pins with tior. (in pwm mode 1, the tioc *b side is not initialized.) 13. set mtu output with the pfc. 14. operation is restarted by tstr.
rev. 2.00, 09/04, page 299 of 720 operation when error occurs during complementary pwm mode operation, and operation is restarted in complementary pwm mode: figure 10.107 shows an explanatory diagram of the case where an error occurs in complementary pwm mode and operation is restarted in complementary pwm mode after re-setting (when operation is restarted using the cycle and duty settings at the time the counter was stopped). 1 reset 2 tocr 3 tmdr (cpwm) 5 pfc (mtu) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 pfc (mtu) 12 tstr (1) 13 match mtu module output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 high-z high-z high-z figure 10.107 error o ccurrence in complementary pwm mode, recovery in complementary pwm mode 1 to 10 are the same as in figure 10.105. 11. set mtu output with the pfc. 12. operation is restarted by tstr. 13. the complementary pwm waveform is output on compare-match occurrence.
rev. 2.00, 09/04, page 300 of 720 operation when error occurs during complementary pwm mode operation, and operation is restarted in complementary pwm mode: figure 10.108 shows an explanatory diagram of the case where an error occurs in complementary pwm mode and operation is restarted in complementary pwm mode after re -setting (when operation is restarted using completely new cycle and duty settings). 1 reset 2 tocr 3 tmdr (cpwm) 5 pfc (mtu) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 toer (0) 13 tocr 14 tmdr (cpwm) 15 toer (1) 16 pfc (mtu) 17 tstr (1) mtu module output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 high-z high-z high-z figure 10.108 error o ccurrence in complementary pwm mode, recovery in complementary pwm mode 1 to 10 are the same as in figure 10.105. 11. set normal mode and make new settings. (mtu output goes low.) 12. disable channel 3 and 4 output with toer. 13. select the complementary pwm mode output level and cyclic output enabling/disabling with tocr. 14. set complementary pwm. 15. enable channel 3 and 4 output with toer. 16. set mtu output with the pfc. 17. operation is restarted by tstr.
rev. 2.00, 09/04, page 301 of 720 operation when error occurs during complementary pwm mode operation, and operation is restarted in reset-synchronous pwm mode: figure 10.109 shows an explanatory diagram of the case where an error occurs in complementary pwm mode and operation is restarted in reset-synchronous pwm mode. 1 reset 2 tocr 3 tmdr (cpwm) 5 pfc (mtu) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 toer (0) 13 tocr 14 tmdr (rpwm) 15 toer (1) 16 pfc (mtu) 17 tstr (1) mtu module output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 high-z high-z high-z figure 10.109 error occurren ce in complementary pwm mode, recovery in reset-synchronous pwm mode 1 to 10 are the same as in figure 10.105. 11. set normal mode. (mtu output goes low.) 12. disable channel 3 and 4 output with toer. 13. select the reset-synchronous pwm mode output level and cyclic output enabling/disabling with tocr. 14. set reset-synchronous pwm. 15. enable channel 3 and 4 output with toer. 16. set mtu output with the pfc. 17. operation is restarted by tstr.
rev. 2.00, 09/04, page 302 of 720 operation when error occurs during rese t-synchronous pwm mode operation, and operation is restarted in normal mode: figure 10.110 shows an explanatory diagram of the case where an error occurs in re set-synchronous pwm mode and operation is restarted in normal mode after re-setting. 1 reset 2 tocr 3 tmdr (cpwm) 5 pfc (mtu) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) mtu module output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 high-z high-z high-z figure 10.110 error occurrence in reset-synchronous pwm mode, recovery in normal mode 1. after a reset, mtu output is low and ports are in the hi gh-impedance state. 2. select the reset-synchronous pwm output level and cyclic output enabling/disabling with tocr. 3. set reset-synchronous pwm. 4. enable channel 3 and 4 output with toer. 5. set mtu output with the pfc. 6. the count operation is started by tstr. 7. the reset-synchronous pwm waveform is output on compare-match occurrence. 8. an error occurs. 9. set port output with the pfc and output the inverse of the active level. 10. the count operation is stopped by tstr. (mtu output becomes the reset-synchronous pwm output initial value.) 11. set normal mode. (mtu positive phase output is low, and negative phase output is high.) 12. initialize the pins with tior. 13. set mtu output with the pfc. 14. operation is restarted by tstr.
rev. 2.00, 09/04, page 303 of 720 operation when error occurs during rese t-synchronous pwm mode operation, and operation is restarted in pwm mode 1: figure 10.111 shows an explanatory diagram of the case where an error occurs in reset-synchronous pwm mode and operation is restarted in pwm mode 1 after re-setting. 1 reset 2 tocr 3 tmdr (rpwm) 5 pfc (mtu) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pwm1) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) mtu module output tioc3a tioc3b tioc3d port output pe9 pe8 pe11  not initialized (tioc3b)  not initialized (tioc3d) high-z high-z high-z figure 10.111 error occurrence in reset-synchronous pwm mode, recovery in pwm mode 1 1 to 10 are the same as in figure 10.110. 11. set pwm mode 1. (mtu positive phase output is low, and negative phase output is high.) 12. initialize the pins with tior. (in pwm mode 1, the tioc *b side is not initialized.) 13. set mtu output with the pfc. 14. operation is restarted by tstr.
rev. 2.00, 09/04, page 304 of 720 operation when error occurs during rese t-synchronous pwm mode operation, and operation is restarted in complementary pwm mode: figure 10.112 shows an explanatory diagram of the case where an error occurs in reset-synchronous pwm mode and operation is restarted in complementary pwm mode after re-setting. 1 reset 2 tocr 3 tmdr (rpwm) 5 pfc (mtu) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 toer (0) 12 tocr 13 tmdr (cpwm) 14 toer (1) 15 pfc (mtu) 16 tstr (1) mtu module output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 high-z high-z high-z figure 10.112 error occurrence in reset-synchronous pwm mode, recovery in complementary pwm mode 1 to 10 are the same as in figure 10.110. 11. disable channel 3 and 4 output with toer. 12. select the complementary pwm output level and cyclic output enabling/disabling with tocr. 13. set complementary pwm. (the mtu cyclic output pin goes low.) 14. enable channel 3 and 4 output with toer. 15. set mtu output with the pfc. 16. operation is restarted by tstr.
rev. 2.00, 09/04, page 305 of 720 operation when error occurs during rese t-synchronous pwm mode operation, and operation is restarted in reset-synchronous pwm mode: figure 10.113 shows an explanatory diagram of the case where an error occurs in reset-synchronous pwm mode and operation is restarted in reset-sync hronous pwm mode after re-setting. 1 reset 2 tocr 3 tmdr (rpwm) 5 pfc (mtu) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 pfc (mtu) 12 tstr (1) 13 match mtu module output tioc3a tioc3b tioc3d port output pe9 pe8 pe11 high-z high-z high-z high-z high-z high-z figure 10.113 error occurrence in reset-synchronous pwm mode, recovery in reset-synchronous pwm mode 1 to 10 are the same as in figure 10.110. 11. set mtu output with the pfc. 12. operation is restarted by tstr. 13. the reset-synchronous pwm waveform is output on compare-match occurrence.
rev. 2.00, 09/04, page 306 of 720 10.9 port output enable (poe) the port output enable (poe) can be used to es tablish a high-impedance state for high-current pins, by changing the poe0 ? poe3 pin input, depending on the output status of the high-current pins (pe9/tioc3b, pe11/tioc3 d, pe12/tioc4a, pe13/tioc4b/ mres , pe14/tioc4c, pe15/tioc4d/ irqout ). it can also simultaneously generate interrupt requests. the high-current pins also become high-impedance regardless of whether these pin functions are selected in cases such as when the oscillator stops or in standby mode. 10.9.1 features ? each of the poe0 ? poe3 input pins can be set for falling edge, p /8 16, p /16 16, or p /128 16 low-level sampling. ? high-current pins can be set to high-impedance state by poe0 ? poe3 pin falling-edge or low- level sampling. ? high-current pins can be set to high-impedance state when the high-current pin output levels are compared and simultaneous low-level output continues for one cycle or more. ? interrupts can be generated by input-level sampling or output-level comparison results.
rev. 2.00, 09/04, page 307 of 720 the poe has input-level detection circuitry and output-level detection circuitry, as shown in the block diagram of figure 10.114. tioc3b tioc3d tioc4a tioc4c tioc4b tioc4d poe3 poe2 poe1 poe0 output level detection circuit output level detection circuit output level detection circuit input level detection circuit falling-edge detection circuit low-level detection circuit ocsr icsr1 /8 /16 /128 high- impedance request control signal interrupt request (mtupoe) [legend] ocsr: output level control/status register icsr1: input level control/status register figure 10.114 poe block diagram
rev. 2.00, 09/04, page 308 of 720 10.9.2 pin configuration table 10.44 pin configuration name abbreviation i/o description port output enable input pins poe0 ? poe3 input input request signals to make high- current pins high-impedance state table 10.45 shows output-level comparisons with pin combinations. table 10.45 pin combinations pin combination i/o description pe9/tioc3b and pe11/tioc3d output all high -current pins are made high-impedance state when the pins simultaneously output low-level for longer than 1 cycle. pe12/tioc4a and pe14/tioc4c output all high -current pins are made high-impedance state when the pins simultaneously output low-level for longer than 1 cycle. pe13/tioc4b/ mres and pe15/tioc4d/ irqout output all high-current pins are made high-impedance state when the pins simultaneously output low-level for longer than 1 cycle. 10.9.3 register configuration the poe has the two registers. the input level control/status register 1 (icsr1) controls both poe0 ? poe3 pin input signal detection and interrupts. the output level control/status register (ocsr) controls both the enable/disable of output comparison and interrupts. input level control/status register 1 (icsr1): the input level control/status register (icsr1) is a 16-bit readable/writable register that selects the poe0 to poe3 pin input modes, controls the enable/disable of interrupts, and indicates status.
rev. 2.00, 09/04, page 309 of 720 bit bit name initial value r/w description 15 poe3f 0 r/(w) * poe3 flag this flag indicates that a high impedance request has been input to the poe3 pin [clear condition] ? by writing 0 to poe3f after reading a poe3f = 1 [set condition] ? when the input set by icsr1 bits 7 and 6 occurs at the poe3 pin 14 poe2f 0 r/(w) * poe2 flag this flag indicates that a high impedance request has been input to the poe2 pin [clear condition] ? by writing 0 to poe2f after reading a poe2f = 1 [set condition] ? when the input set by icsr1 bits 5 and 4 occurs at the poe2 pin 13 poe1f 0 r/(w) * poe1 flag this flag indicates that a high impedance request has been input to the poe1 pin [clear condition] ? by writing 0 to poe1f after reading a poe1f = 1 [set condition] ? when the input set by icsr1 bits 3 and 2 occurs at the poe1 pin 12 poe0f 0 r/(w) * poe0 flag this flag indicates that a high impedance request has been input to the poe0 pin [clear condition] ? by writing 0 to poe0f after reading a poe0f = 1 [set condition] ? when the input set by icsr1 bits 1 and 0 occurs at the poe0 pin
rev. 2.00, 09/04, page 310 of 720 bit bit name initial value r/w description 11 to 9 ? all 0 r reserved these bits are always read as 0. these bits should always be written with 0 8 pie 0 r/w port interrupt enable this bit enables/disables interrupt requests when any of the poe0f to poe3f bits of the icsr1 are set to 1 0: interrupt requests disabled 1: interrupt requests enabled 7 6 poe3m1 poe3m0 0 0 r/w r/w poe3 mode 1, 0 these bits select the input mode of the poe3 pin 00: accept request on falling edge of poe3 input 01: accept request when poe3 input has been sampled for 16 p /8 clock pulses, and all are low level. 10: accept request when poe3 input has been sampled for 16 p /16 clock pulses, and all are low level. 11: accept request when poe3 input has been sampled for 16 p /128 clock pulses, and all are low level. 5 4 poe2m1 poe2m0 0 0 r/w r/w poe2 mode 1, 0 these bits select the input mode of the poe2 pin 00: accept request on falling edge of poe2 input 01: accept request when poe2 input has been sampled for 16 p /8 clock pulses, and all are low level. 10: accept request when poe2 input has been sampled for 16 p /16 clock pulses, and all are low level. 11: accept request when poe2 input has been sampled for 16 p /128 clock pulses, and all are low level. 3 2 poe1m1 poe1m0 0 0 r/w r/w poe1 mode 1, 0 these bits select the input mode of the poe1 pin 00: accept request on falling edge of poe1 input 01: accept request when poe1 input has been sampled for 16 p /8 clock pulses, and all are low level. 10: accept request when poe1 input has been sampled for 16 p /16 clock pulses, and all are low level. 11: accept request when poe1 input has been sampled for 16 p /128 clock pulses, and all are low level.
rev. 2.00, 09/04, page 311 of 720 bit bit name initial value r/w description 1 0 poe0m1 poe0m0 0 0 r/w r/w poe0 mode 1, 0 these bits select the input mode of the poe0 pin 00: accept request on falling edge of poe0 input 01: accept request when poe0 input has been sampled for 16 p /8 clock pulses, and all are low level. 10: accept request when poe0 input has been sampled for 16 p /16 clock pulses, and all are low level. 11: accept request when poe0 input has been sampled for 16 p /128 clock pulses, and all are low level. note: * the write value should always be 0. output level control/status register (ocsr): the output level control/status register (ocsr) is a 16-bit readable/writable register that cont rols the enable/disable of both output level comparison and interrupts, and indicates status. if the osf bit is set to 1, the high current pins become high impedance. bit bit name initial value r/w description 15 osf 0 r/(w) * output short flag this flag indicates that any one pair of the three pairs of 2 phase outputs compared have simultaneously become low level outputs. [clear condition] ? by writing 0 to osf after reading an osf = 1 [set condition] ? when any one pair of the three 2-phase outputs simultaneously become low level 14 to 10 ? all 0 r reserved these bits are always read as 0. these bits should always be written with 0
rev. 2.00, 09/04, page 312 of 720 bit bit name initial value r/w description 9 oce 0 r/w output level compare enable this bit enables the start of output level comparisons. when setting this bit to 1, pay attention to the output pin combinations shown in table 10.43, mode transition combinations. when 0 is output, the osf bit is set to 1 at the same time when this bit is set, and output goes to high impedance. accordingly, bits 15 to 11 and bit 9 of the port e data register (pedr) are set to 1. for the mtu output comparison, set the bit to 1 after setting the mtu's output pins with the pfc. set this bit only when using pins as outputs. when the oce bit is set to 1, if oie = 0 a high-impedance request will not be issued even if osf is set to 1. therefore, in order to hav e a high-impedance request issued according to the result of the output level comparison, the oie bit must be set to 1. when oce = 1 and oie = 1, an interrupt request will be generated at the same time as the high-impedance request: however, this interrupt can be masked by means of an interrupt controller (intc) setting. 0: output level compare disabled 1: output level compare enabled; makes an output high impedance request when osf = 1. 8 oie 0 r/w output short interrupt enable this bit makes interrupt requests when the osf bit of the ocsr is set. 0: interrupt requests disabled 1: interrupt request enabled 7 to 0 ? all 0 r reserved these bits are always read as 0. these bits should always be written with 0. note: * the write value should always be 0.
rev. 2.00, 09/04, page 313 of 720 10.9.4 operation input level detection operation: if the input conditions set by the icsr1 occur on any of the poe pins, all high-current pins become high-impedance state. however, only when the general input/output function or mtu function is selected, the large-current pin is in the high-impedance state. 1. falling edge detection when a change from high to low level is input to the poe pins. 2. low-level detection figure 10.115 shows the low-level detection operation. sixteen continuous low levels are sampled with the sampling clock established by the icsr1. if even one high level is detected during this interval, the low level is not accepted. furthermore, the timing when the large-curren t pins enter the high-i mpedance state from the sampling clock is the same in both falling-edge detection and in low-level detection. p sampling clock 3 poe input pe9/ tioc3b when low level is sampled at all points when high level is sampled at least once flag set (poe received) flag not set high-impedance state* note: * other large-current pins (pe11/tioc3d, pe12/tioc4a, pe13/tioc4b/ mres , pe14/tioc4c, pe15/tioc4d/ irqout ) also go to the high-impedance state at the same timing. 2 1 2 1 16 13 8/16/128 clock cycles figure 10.115 low-le vel detection operation
rev. 2.00, 09/04, page 314 of 720 output-level compare operation: figure 10.116 shows an exam ple of the output-level compare operation for the combin ation of pe9/tioc3b and pe11/tioc3d. the operation is the same for the other pin combinations. p pe11/ tioc3d pe9/ tioc3b 0 level overlapping detected high impedance state figure 10.116 output-l evel detection operation release from high-impedance state: high-current pins that have entered high-impedance state due to input-level detection can be released either by returning them to their initial state with a power-on reset, or by clearing all of the bit 12?15 (poe0f?poe3f) flags of the icsr1. high- current pins that have become high-impedance due to output-level detection can be released either by returning them to their initial state with a power-on reset, or by first clearing bit 9 (oce) of the ocsr to disable output-level co mpares, then clearing the bit 15 (osf) flag. however, when returning from high-impedance state by clearing the osf flag, always do so only after outputting a high level from the high-current pins (tioc3b, tioc3d, tioc4a, tioc4b, tioc4c, and tioc4d). high-level outputs can be achieved by setting the mtu internal registers.
rev. 2.00, 09/04, page 315 of 720 poe timing: figure 10.117 shows an example of timing from poe input to high impedance of pin. poe input ck falling ck pe9/ tioc3b falling edge detected high impedance state note: other large-current pins (pe11/tico3d, pe12/tioc4a, pe13/tioc4b/ mres , pe14/tioc4c, pe15/tioc4d/ irqout ) also goes to the high impedance state at the same timing figure 10.117 falling edge detection operation 10.9.5 usage notes 1. to set the poe pin as a level-detective pin, a high level signal must be firstly input to the poe pin. 2. to clear bits poe0f, poe1f, poe2f, poe3f, and osf to 0, read registers icsr1 and ocsr. clear bits, which are read as 1, to 0, and write 1 to the other bits in the registers.
rev. 2.00, 09/04, page 316 of 720
rev. 2.00, 09/04, page 317 of 720 section 11 watchdog timer the watchdog timer (wdt) is an 8-bit timer that can reset this lsi internally if the counter overflows without rewriting the counter value due to a system crash or the like. when this watchdog function is not needed, the wdt can be used as an interval timer. in interval timer operation, an interval timer interrupt is generated each time the counter overflows. the block diagram of the wdt is shown in figure 11.1. 11.1 features ? switchable between watchdog timer mode and interval timer mode in watchdog timer mode ? output wdtovf signal if the counter overflows, it is possible to select whether this lsi is internally reset or not. a power-on reset or manual reset can be selected as an in internal reset. in interval timer mode ? if the counter overflows, the wdt generates an interval timer interrupt (iti). ? clears software standby mode ? selectable from eight counter input clocks.
rev. 2.00, 09/04, page 318 of 720 overflow interrupt control iti (interrupt request signal) internal reset signal* reset control rstcsr tcnt tscr /2 /64 /128 /256 /512 /1024 /4096 /8192 clock clock select internal clock sources bus interface module bus internal bus wdt [legend] tcsr: timer control/status register tcnt: timer counter rstcsr: reset control/status register note: * the internal reset signal can be generated by making a register setting. power-on reset or manual reset can be selected. wdtovf figure 11.1 block diagram of wdt 11.2 input/output pin table 11.1 shows the pin configuration. table 11.1 pin configuration pin abbreviation i/o function watchdog timer overflow wdtovf * o outputs the counter overflow signal in watchdog timer mode note: * wdtovf pin should not be pulled-down. if this pin need to be pulled-down, the pull- down resistance value must be 1 m ? or higher.
rev. 2.00, 09/04, page 319 of 720 11.3 register descriptions the wdt has the following three registers. for details, refer to appendix a, internal i/o register. to prevent accidental overwriting, tcsr, tcnt, and rstcsr have to be written to in a method different from normal registers. for details, refer to section 11.6.1, notes on register access. ? timer control/status register (tcsr) ? timer counter (tcnt) ? reset control/status register (rstcsr) 11.3.1 timer counter (tcnt) tcnt is an 8-bit readable/writable upcounter. when the timer enable bit (tme) in the timer control/status register (tcsr) is set to 1, tcnt starts counting pulses of an internal clock selected by clock select bits 2 to 0 (cks2 to cks0) in tcsr. when the value of tcnt overflows (changes from h'ff to h'00), a watchdog timer overflow signal ( wdtovf ) or interval timer interrupt (iti) is generated, depending on the mode selected in the wt/ it bit of tcsr. the initial value of tcnt is h'00. 11.3.2 timer control/s tatus register (tcsr) tcsr is an 8-bit readable/writable register. its functions include selecting the clock source to be input to tcnt, and the timer mode. bit bit name initial value r/w description 7 ovf 0 r/(w) * 1 overflow flag indicates that tcnt has overflowed in interval timer mode. only a write of 0 is permitted, to clear the flag. this flag is not set in watchdog timer mode. [setting condition] ? when tcnt overflows in interval timer mode. [clearing conditions] ? written 0 after reading ovf ? when 0 is written to the tme bit in interval timer mode
rev. 2.00, 09/04, page 320 of 720 bit bit name initial value r/w description 6 wt/ it 0 r/w timer mode select selects whether the wdt is used as a watchdog timer or interval timer. when tcnt overflows, the wdt either generates an interval timer interrupt (iti) or generates a wdtovf signal, depending on the mode selected. 0: interval timer mode interval timer interrupt (iti) request to the cpu when tcnt overflows 1: watchdog timer mode wdtovf signal output externally when tcnt overflows * 2 . 5 tme 0 r/w timer enable enables or disables the timer. 0: timer disabled tcnt is initialized to h'00 and count-up stops 1: timer enabled tcnt starts counting. a wdtovf signal or interrupt is generated when tcnt overflows. 4, 3 ? all 1 r reserved this bit is always read as 1, and should only be written with 1. 2 1 0 cks2 cks1 cks0 0 0 0 r/w r/w r/w clock select 2 to 0 select one of eight internal clock sources for input to tcnt. the clock signals are obtained by dividing the frequency of the system clock ( ). the overflow frequency for = 40 mhz is enclosed in parentheses * 3 . 000: clock /2 (period: 12.8 s) 001: clock /64 (period: 409.6 s) 010: clock /128 (period: 0.8 ms) 011: clock /256 (period: 1.6 ms) 100: clock /512 (period: 3.3 ms) 101: clock /1024 (period: 6.6 ms) 110: clock /4096 (period: 26.2 ms) 111: clock /8192 (period: 52.4 ms) notes: 1. only a 0 can be written after reading 1. 2. section 11.3.3, reset control/status r egister (rstcsr), describes in detail what happens when tcnt overflows in watchdog timer mode. 3. the overflow interval listed is the time from when the tcnt begins counting at h'00 until an overflow occurs.
rev. 2.00, 09/04, page 321 of 720 11.3.3 reset control/status register (rstcsr) rstcsr is an 8-bit readable/writable register th at controls the generation of the internal reset signal when tcnt overflows. bit bit name initial value r/w description 7 wovf 0 r/(w) * watchdog overflow flag this bit is set when tcnt overflows in watchdog timer mode. this bit cannot be set in interval timer mode. [setting condition] ? set when tcnt overflows in watchdog timer mode [clearing condition] ? cleared by reading wovf, and then writing 0 to wovf 6 rste 0 r/w reset enable specifies whether or not a reset signal is generated in the chip if tcnt overflows in watchdog timer mode. 0: reset signal is not generated even if tcnt overflows (though other peripheral module registers are not reset, tcnt and tcsr in wdt are reset) 1: reset signal is generated if tcnt overflows 5 rsts 0 r/w reset select selects the type of internal reset generated if tcnt overflows in watchdog timer mode. 0: power-on reset 1: manual reset 4 to 0 ? all 1 r reserved these bits are always read as 1, and should only be written with 1. note: * only 0 can be written, for flag clearing.
rev. 2.00, 09/04, page 322 of 720 11.4 operation 11.4.1 watchdog timer mode to use the wdt as a watchdog timer, set the wt/ it and tme bits of tcsr to 1. software must prevent tcnt overflow by rewriting the tcnt value (normally by writing h'00) before overflow occurs. no tcnt overflows will occur while the system is operating normally, but if tcnt fails to be rewritten and overflows occur due to a system crash or the like, a wdtovf signal is output externally. the wdtovf signal can be used to reset the system. the wdtovf signal is output for 128 clock cycles. if the rste bit in rstcsr is set to 1, a signal to reset the chip will be generated internally simultaneous to the wdtovf signal when tcnt overflows. ei ther a power-on reset or a manual reset can be selected by the rsts bit in rstcsr . the internal reset signal is output for 512 clock cycles. when a wdt overflow reset is generated simultaneously with a reset input at the res pin, the res reset takes priority, and the wovf bit in rstcsr is cleared to 0. the following are not initialized by a wdt reset signal: ? poe (port output enable) of mtu and mmt registers ? pfc (pin function controller) registers ? i/o port registers these registers are initialized only by an external power-on reset.
rev. 2.00, 09/04, page 323 of 720 tcnt value h'ff h'00 wdtovf signal internal reset signal * overflow h'00 written in tcnt wt/ it = 1 tme = 1 h'00 written in tcnt wt/ it = 1 tme = 1 wovf = 1 wdtovf and internal reset generated 128 clocks 512 clocks wt/it: timer mode select bit tme: timer enable bit note: * internal reset signal occurs only when the rste bit is set to 1. time figure 11.2 operation in watchdog timer mode 11.4.2 interval timer mode to use the wdt as an interval timer, clear wt/ it to 0 and set tme to 1 in tcsr. an interval timer interrupt (iti) is generated each time the tim er counter (tcnt) overflows. this function can be used to generate interval timer interrupts at regular intervals. tcnt value h'ff h'00 overflow wt/ it = 0 tme = 1 overflow overflow overflow iti iti iti iti time iti: interval timer interrupt request generation figure 11.3 operation in interval timer mode
rev. 2.00, 09/04, page 324 of 720 11.4.3 clearing soft ware standby mode the watchdog timer has a special function to clear software standby mode with an nmi interrupt or irq0 to irq3 interrupts. when using software standby mode, set the wdt as described below. before transition to software standby mode: the tme bit in tcsr must be cleared to 0 to stop the watchdog timer counter before entering software standby mode. the chip cannot enter software standby mode while the tme bit is set to 1. set bits cks2 to cks0 in tcsr so that the counter overflow interval is equal to or longer than the oscillation settling time. see section 25.3, ac characteristics, for the oscillation settling time. recovery from software standby mode: when an nmi signal or irq0 to irq3 signals are received in software standby mode, the clock oscillator star ts running and tcnt starts incrementing at the rate selected by bits cks2 to cks0 before software standby mode was entered. when tcnt overflows (cha nges from h'ff to h'00), the clock is presumed to be stable and usable; clock signals are supplied to the entire chip and software standby mode ends. for details on software standby mode, see section 24, power-down modes. 11.4.4 timing of setting the overflow flag (ovf) in interval timer mode, when tcnt overflows, the ovf bit of tcsr is set to 1 and an interval timer interrupt (iti) is simultaneously requested. figure 11.4 shows this timing. tcnt overflow signal (internal signal) ovf h'ff h'00 figure 11.4 timing of setting ovf
rev. 2.00, 09/04, page 325 of 720 11.4.5 timing of setting the watc hdog timer overflow flag (wovf) when tcnt overflows in watchdog timer mode, the wovf bit of rstcsr is set to 1 and a wdtovf signal is output. when the rste bit in rstcsr is set to 1, tcnt overflow enables an internal reset signal to be generated for the entire chip. figure 11.5 shows this timing. tcnt overflow signal (internal signal) wovf h'ff h'00 figure 11.5 timing of setting wovf 11.5 interrupts during interval timer mode operation, an overflow generates an interval timer interrupt (iti). the interval timer interrupt is requested whenever the ovf flag is set to 1 in tcsr. ovf must be cleared to 0 in the interrupt handling routine. table 11.2 wdt interrupt source (in interval timer mode) name interrupt source interrupt flag dtc activation iti tcnt overflow ovf impossible 11.6 usage notes 11.6.1 notes on register access the watchdog timer?s tcnt, tcsr, and rstcsr re gisters differ from other registers in being more difficult to write to. the procedures for writing to and reading these registers are given below. writing to tcnt and tcsr: these registers must be written by a word transfer instruction. they cannot be written by byte transfer instructions.
rev. 2.00, 09/04, page 326 of 720 tcnt and tcsr both have the same write address. the write data must be contained in the lower byte of the written word. the upper byte must be h'5a (for tcnt) or h'a5 (for tcsr) (figure 11.6). this transfers the write data from the lower byte to tcnt or tcsr. 15 8 7 0 15 8 7 0 h'5a h'a5 write data write data  writing to tcnt  writing to tcsr address: h'ffff8610 address: h'ffff8610 figure 11.6 writing to tcnt and tcsr writing to rstcsr: rstcsr must be written by a wo rd access to address h'ffff8612. it cannot be written by byte transfer instructions. procedures for writing 0 to wovf (bit 7) and for writing to rste (bit 6) and rsts (bit 5) are different, as shown in figure 11.7. to write 0 to the wovf bit, the write data must be h'a5 in the upper byte and h'00 in the lower byte. this clears the wovf bit to 0. the rste and rsts bits are not affected. to write to the rste and rsts bits, the upper byte must be h'5a and the lower byte must be the write data. the values of bits 6 and 5 of the lower byte are transferred to the rste and rsts bits, respectively. the wovf bit is not affected. 15 8 7 0 15 8 7 0 h'a5 h'5a write data  writing 0 to the wovf bit  writing to the rste and rsts bits address: h'ffff8612 address: h'ffff8612 h?00 figure 11.7 writing to rstcsr
rev. 2.00, 09/04, page 327 of 720 reading from tcnt, tcsr, and rstcsr: tcnt, tcsr, and rstcsr are read like other registers. use byte transfer instructions. the read addresses are h'ffff8610 for tcsr, h'ffff8611 for tcnt, and h'ffff8613 for rstcsr. 11.6.2 tcnt write an d increment contention if a timer counter increment clock pulse is generate d during the t3 state of a write cycle to tcnt, the write takes priority and the timer counter is no t incremented. figure 11.8 shows this operation. address internal write signal tcnt input clock tcnt n m t 1 t 2 tcnt write cycle counter write data t 3 tcnt address figure 11.8 contention betw een tcnt write and increment 11.6.3 changing cks2 to cks0 bit values if the values of bits cks2 to cks0 in the timer control/status register (t csr) are rewritten while the wdt is running, the count may not increment correctly. always stop the watchdog timer (by clearing the tme bit to 0) before rewriting the values of bits cks2 to cks0. 11.6.4 changing between watchdo g timer/interval timer modes to prevent incorrect operation, always stop th e watchdog timer (by clearing the tme bit to 0) before switching between interval timer mode and watchdog timer mode.
rev. 2.00, 09/04, page 328 of 720 11.6.5 system reset by wdtovf signal if a wdtovf output signal is input to the res pin, the chip cannot initialize correctly. avoid logical input of the wdtovf signal to the res input pin. to reset the entire system with the wdtovf signal, use the circuit shown in figure 11.9. reset input reset signal to entire system this lsi res wdtovf figure 11.9 example of system reset circuit using wdtovf signal 11.6.6 internal reset in watchdog timer mode if the rste bit is cleared to 0 in watchdog timer mode, the chip will not be reset internally when a tcnt overflow occurs, but tcnt and tcsr in the wdt will be reset. 11.6.7 manual reset in watchdog timer mode when an internal reset is effected by tcnt overflow in watchdog timer mode, the processor waits until the end of the bus cycle at the time of manual reset generation before making the transition to manual reset exception processing. therefore, the bus cycle is retained in a manual reset, but if a manual reset occurs while the bus is released, manual reset exception processing will be deferred until the cpu acquires the bus. however, if the interval from generation of the manual reset until the end of the bus cycle is equal to or longer than the internal manu al reset interval of 512 cycles, the internal manual reset source is ignored instead of being deferred, and manual reset exception processing is not executed. 11.6.8 handling of wdtovf pin do not pull-down the wdtovf pin. if this pin need to be pulled-down, the pull-down resistance value must be 1 m ? or higher.
rev. 2.00, 09/04, page 329 of 720 section 12 serial co mmunication interface (sci) this lsi has three independent serial communication interface (sci) channels. the sci can handle both asynchronous and clocked synchronous serial communication. in asynchronous serial communication mode, serial data communication can be carried out with standard asynchronous communication chips such as a universal asynchr onous receiver/transmitter (uart) or asynchronous communication interf ace adapter (acia). a function is also provided for serial communication between processors (mu ltiprocessor communication function). 12.1 features ? choice of asynchronous or clocked synchronous serial communication mode ? full-duplex communication capability the transmitter and receiver are mutually independ ent, enabling transmission and reception to be executed simultaneously. double-buffering is used in both the transmitter and the receiver, enabling continuous transmission and continuous reception of serial data. ? on-chip baud rate generator allows any bit rate to be selected external clock can be selected as a transfer clock source. ? choice of lsb-first or msb-first transfer (except in the case of asynchronous mode 7-bit data) ? four interrupt sources four interrupt sources ? transmit-end, transmit-data-empty , receive-data-full, and receive error ? that can issue requests. the transmit-data-empty in terrupt and receive data full interrupts can activate the data transfer controller (dtc). ? module standby mode can be set asynchronous mode ? data length: 7 or 8 bits ? stop bit length: 1 or 2 bits ? parity: even, odd, or none ? multiprocessor bit: 1 or 0 ? receive error detection: parity , overrun, and framing errors ? break detection: break can be detected by r eading the rxd pin level directly in case of a framing error
rev. 2.00, 09/04, page 330 of 720 clocked synchronous mode ? data length: 8 bits ? receive error detection: overrun errors detected note: the description in this sectio n are based on lsb-first transfer. figure 12.1 shows a block diagram of the sci. rxd txd sck clock p p /8 p /32 p /128 tei txi rxi eri ssr scr smr sdcr transmission/ reception control baud rate generator brr module data bus rdr tsr rsr parity generation [legend] rsr: receive shift register rdr: receive data register tsr: transmit shift register tdr: transmit data register smr: serial mode register scr: serial control register ssr: serial status register brr: bit rate register sdcr: serial direction control register tdr bus interface internal data bus parity check external clock figure 12.1 block diagram of sci
rev. 2.00, 09/04, page 331 of 720 12.2 input/output pins table 12.1 shows the serial pins for each sci channel. table 12.1 pin configuration channel pin name * i/o function sck2 i/o sci2 clock input/output rxd2 input sci2 receive data input 2 txd2 output sci2 transmit data output sck3 i/o sci3 clock input/output rxd3 input sci3 receive data input 3 txd3 output sci3 transmit data output sck4 i/o sci4 clock input/output rxd4 input sci4 receive data input 4 txd4 output sci4 transmit data output notes: * pin names sck, rxd, and txd are used in the text for all channels, omitting the channel designation.
rev. 2.00, 09/04, page 332 of 720 12.3 register descriptions the sci has the following registers for each channel. for details on register addresses and register states during each processing, refer to appendix a, internal i/o register. channel 2 ? serial mode register_2 (smr_2) ? bit rate register_2 (brr_2) ? serial control register_2 (scr_2) ? transmit data register_2 (tdr_2) ? serial status re gister_2 (ssr_2) ? receive data register_2 (rdr_2) ? serial direction control register_2 (sdcr_2) channel 3 ? serial mode register_3 (smr_3) ? bit rate register_3 (brr_3) ? serial control register_3 (scr_3) ? transmit data register_3 (tdr_3) ? serial status re gister_3 (ssr_3) ? receive data register_3 (rdr_3) ? serial direction control register_3 (sdcr_3) channel 4 ? serial mode register_4 (smr_4) ? bit rate register_4 (brr_4) ? serial control register_4 (scr_4) ? transmit data register_4 (tdr_4) ? serial status re gister_4 (ssr_4) ? receive data register_4 (rdr_4) ? serial direction control register_4 (sdcr_4)
rev. 2.00, 09/04, page 333 of 720 12.3.1 receive shi ft register (rsr) rsr is a shift register used to receive serial data that is input to the rxd pin and convert it into parallel data. when one byte of data has been r eceived, it is transferre d to rdr automatically. rsr cannot be directly read or written to by the cpu. 12.3.2 receive data register (rdr) rdr is an 8-bit register that stores receive data . when the sci has received one byte of serial data, it transfers the received serial data from rsr to rdr where it is stored. after this, rsr is receive-enabled. since rsr and rdr function as a do uble buffer in this wa y, enables continuous receive operations to be performed. after confirmi ng that the rdrf bit in ssr is set to 1, read rdr for only once. rdr cannot be written to by the cpu. the initial value of rdr is h'00. 12.3.3 transmit shift register (tsr) tsr is a shift register that transmits serial data. to perform serial data transmission, the sci first transfers transmit data fr om tdr to tsr, then sends the data to the txd pin. tsr cannot be directly accessed by the cpu. 12.3.4 transmit data register (tdr) tdr is an 8-bit register that stores transmit data . when the sci detects that tsr is empty, it transfers the transmit data written in tdr to tsr and starts transmission. the double-buffered structures of tdr and tsr enables continuous se rial transmission. if the next transmit data has already been written to tdr during serial transm ission, the sci transfers the written data to tsr to continue transmission. although tdr can be r ead or written to by the cpu at all times, to achieve reliable serial transmission, write transmit data to tdr for only once after confirming that the tdre bit in ssr is set to 1. the initial value of tdr is h'ff.
rev. 2.00, 09/04, page 334 of 720 12.3.5 serial mode register (smr) smr is used to set the sci?s serial transfer format and select the baud rate generator clock source. bit bit name initial value r/w description 7 c/ a 0 r/w communication mode 0: asynchronous mode 1: clocked synchronous mode 6 chr 0 r/w character length (enabled only in asynchronous mode) 0: selects 8 bits as the data length. 1: selects 7 bits as the data length. lsb-first is fixed and the msb (bit 7) of t dr is not transmitted in transmission. in clocked synchronous mode, a fixed data length of 8 bits is used. 5 pe 0 r/w parity enable (enabled only in asynchronous mode) when this bit is set to 1, the parity bit is added to transmit data before transmission, and the parity bit is checked in reception. fo r a multiprocessor format, parity bit addition and checking are not performed regardless of the pe bit setting. 4 o/ e 0 r/w parity mode (enabled only when the pe bit is 1 in asynchronous mode) 0: selects even parity. 1: selects odd parity. 3 stop 0 r/w stop bit length (enabled only in asynchronous mode) selects the stop bit length in transmission. 0: 1 stop bit 1: 2 stop bits in reception, only the first stop bit is checked. if the second stop bit is 0, it is treated as the start bit of the next transmit character. 2 mp 0 r/w multiprocessor mode (enabled only in asynchronous mode) when this bit is set to 1, the multiprocessor communication function is enabled. the pe bit and o/ e bit settings are invalid in multiprocessor mode.
rev. 2.00, 09/04, page 335 of 720 bit bit name initial value r/w description 1 0 cks1 cks0 0 0 r/w r/w clock select 1 and 0 these bits select the clock source for the baud rate generator. 00: p clock (n = 0) 01: p /8 clock (n = 1) 10:p /32 clock (n = 2) 11:p /128 clock (n = 3) for the relation between the bit rate register setting and the baud rate, see section 12.3.9, bit rate register (brr). n is the decimal display of the value of n in brr (see section 12.3.9, bit rate register (brr)). 12.3.6 serial control register (scr) scr is a register that performs enabling or disabling of sci transfer operations and interrupt requests, and selection of the tr ansfer clock source. for details on interrupt requests, refer to section 12.7, sci interrupts. bit bit name initial value r/w description 7 tie 0 r/w transmit interrupt enable when this bit is set to 1, txi interrupt request is enabled. 6 rie 0 r/w receive interrupt enable when this bit is set to 1, rxi and eri interrupt requests are enabled. 5 te 0 r/w transmit enable when this bit is set to 1, transmission is enabled. 4 re 0 r/w receive enable when this bit is set to 1, reception is enabled.
rev. 2.00, 09/04, page 336 of 720 bit bit name initial value r/w description 3 mpie 0 r/w multiprocessor interrupt enable (enabled only when the mp bit in smr is 1 in asynchronous mode) when this bit is set to 1, receive data in which the multiprocessor bit is 0 is skipped, and setting of the rdrf, fer, and orer status flags in ssr is prohibited. on receiving data in which the multiprocessor bit is 1, this bit is automatically cleared and normal reception is resumed. for details, refer to section 12.5, multiprocessor communication function. 2 teie 0 r/w transmit end interrupt enable this bit is set to 1, tei interrupt request is enabled. 1 0 cke1 cke0 0 0 r/w r/w clock enable 1 and 0 selects the clock source and sck pin function. asynchronous mode: 00: internal clock, sck pin used for input pin (input signal is ignored) or output pin (output level is undefined) 01: internal clock, sck pin used for clock output (the output clock frequency is the same as the bit rate) 10: external clock, sck pin used for clock input (the input clock frequency is 16 times the bit rate) 11: external clock, sck pin used for clock input (the input clock frequency is 16 times the bit rate) clocked synchronous mode: 00: internal clock, sck pin used for synchronous clock output 01: internal clock, sck pin used for synchronous clock output 10: external clock, sck pin used for synchronous clock input 11: external clock, sck pin used for synchronous clock input
rev. 2.00, 09/04, page 337 of 720 12.3.7 serial status register (ssr) ssr is a register containing status flags of th e sci and multiprocessor bi ts for transfer. 1 cannot be written to flags tdre, rdrf, orer, pe r, and fer; they can only be cleared. bit bit name initial value r/w description 7 tdre 1 r/(w) * transmit data register empty displays whether tdr contains transmit data. [setting conditions] ? power-on reset, hardware standby mode, or software standby mode ? when the te bit in scr is 0 ? when data is transferred from tdr to tsr and data can be written to tdr [clearing conditions] ? when 0 is written to tdre after reading tdre = 1 ? when the dtc is activated by a txi interrupt request and transferred data to tdr 6 rdrf 0 r/(w) * receive data register full indicates that the received data is stored in rdr. [setting condition] ? when serial reception ends normally and receive data is transferred from rsr to rdr [clearing conditions] ? power-on reset, hardware standby mode, or software standby mode ? when 0 is written to rdrf after reading rdrf = 1 ? when the dtc is activated by an rxi interrupt and transferred data from rdr the rdrf flag is not affected and retains their previous values when the re bit in scr is cleared to 0.
rev. 2.00, 09/04, page 338 of 720 bit bit name initial value r/w description 5 orer 0 r/(w) * overrun error [setting condition] ? when the next serial reception is completed while rdrf = 1 [clearing conditions] ? power-on reset, hardware standby mode, or software standby mode ? when 0 is written to orer after reading orer = 1 the orer flag is not affected and retains their previous values when the re bit in scr is cleared to 0. 4 fer 0 r/(w) * framing error [setting condition] ? when the stop bit is 0 [clearing conditions] ? power-on reset, hardware standby mode, or software standby mode ? when 0 is written to fer after reading fer = 1 in 2-stop-bit mode, only the first stop bit is checked. the fer flag is not affected and retains their previous values when the re bit in scr is cleared to 0. 3 per 0 r/(w) * parity error [setting condition] ? when a parity error is detected during reception [clearing conditions] ? power-on reset, hardware standby mode, or software standby mode ? when 0 is written to per after reading per = 1 the per flag is not affected and retains their previous values when the re bit in scr is cleared to 0.
rev. 2.00, 09/04, page 339 of 720 bit bit name initial value r/w description 2 tend 1 r transmit end [setting conditions] ? power-on reset, hardware standby mode, or software standby mode ? when the te bit in scr is 0 ? when tdre = 1 at transmission of the last bit of a 1-byte serial transmit character [clearing conditions] ? when 0 is written to tdre after reading tdre = 1 ? when the dtc is activated by a txi interrupt and writes data to tdr 1 mpb 0 r multiprocessor bit mpb stores the multiprocessor bit in the receive data. when the re bit in scr is cleared to 0 its previous state is retained. 0 mpbt 0 r/w multiprocessor bit transfer mpbt sets the multiprocessor bit value to be added to the transmit data. note: * only 0 can be written, for flag clearing.
rev. 2.00, 09/04, page 340 of 720 12.3.8 serial direction control register (sdcr) the dir bit in the serial directi on control register (sdcr) selects lsb-first or msb-first transfer. with an 8-bit data length, lsb-first/msb-first selection is available regardless of the communication mode. with a 7-bit data length , lsb-first transfer must be selected. the description in this section assumes lsb-first transfer. bit bit name initial value r/w description 7 to 4 ? all 1 r reserved the write value must always be 1. operation cannot be guaranteed if 0 is written. 3 dir 0 r/w data transfer direction selects the serial/parallel conversion format. valid for an 8-bit transmit/receive format. 0: tdr contents are transmitted in lsb-first order receive data is stored in rdr in lsb-first 1: tdr contents are transmitted in msb-first order receive data is stored in rdr in msb-first 2 ? 0 r reserved the write value must always be 0. operation cannot be guaranteed if 1 is written. 1 ? 1 r reserved this bit is always read as 1, and cannot be modified. 0 ? 0 r reserved the write value must always be 0. operation cannot be guaranteed if 1 is written. 12.3.9 bit rate register (brr) brr is an 8-bit register that adjusts the bit rate. as the sci performs baud rate generator control independently for each channel, different bit rates can be set for each channel. table 12.2 shows the relationships between the n setting in brr and the effective bit rate b 0 for asynchronous and clocked synchronous modes. the initial value of brr is h'ff, and it can be read or written to by the cpu at all times.
rev. 2.00, 09/04, page 341 of 720 table 12.2 relationships between n sett ing in brr and effective bit rate b 0 mode asynchronous mode (n = 0) asynchronous mode (n = 1 to 3) clocked synchronous mode (n = 0) clocked synchronous mode (n = 1 to 3) b 0 = p 10 6 32 2 2n (n + 1) bit rate error b 0 b 1 b 0 = p 10 6 32 2 2n+1 (n + 1) b 0 = p 10 6 4 2 2n (n + 1) b 0 = p 10 6 4 2 2n+1 (n + 1) error (%) = ? 1 100 ? ? ? ? b 0 b 1 error (%) = ? ? ? 1 100 ? ? ? ? notes: b 0 : effective bit rate (bit/s) actual transfe r speed according to the register settings b 1 : logical bit rate (bit/s) specified transfer speed of the target system n: brr setting for baud rate generator (0 n 255) p : peripheral clock operating frequency (mhz) n : determined by the smr settings shown in the following tables. smr setting cks1 cks0 n 0 0 0 0 1 1 1 0 2 1 1 3 table 12.3 shows sample n settings in brr in normal asynchronous mode. table 12.4 shows the maximum bit rate for each frequency in normal asynchronous mode. table 12.6 shows sample n settings in brr in clocked synchronous mode. for details, refer to section 12.4.2, receive data sampling timing and reception margin in asynchronous mode. tables 12.5 and 12.7 show the maximum bit rates with external clock input.
rev. 2.00, 09/04, page 342 of 720 table 12.3 brr settings for various bit rates (asynchronous mode) (1) operating frequency p (mhz) 4 6 8 10 12 logical bit rate (bit/s) n n error ( % ) n n error ( % ) n n error ( % ) n n error ( % ) n n error ( % ) 110 1 140 0.74 1 212 0.03 2 70 0.03 2 88 ?0.25 2 106 ?0.44 150 1 103 0.16 1 155 0.16 2 51 0.16 2 64 0.16 2 77 0.16 300 1 51 0.16 1 77 0.16 2 25 0.16 1 129 0.16 2 38 0.16 600 1 25 0.16 1 38 0.16 2 12 0.16 1 64 0.16 1 77 0.16 1200 1 12 0.16 0 155 0.16 1 25 0.16 1 32 ?1.36 1 38 0.16 2400 0 51 0.16 0 77 0.16 1 12 0.16 0 129 0.16 0 155 0.16 4800 0 25 0.16 0 38 0.16 0 51 0.16 0 64 0.16 0 77 0.16 9600 0 12 0.16 0 19 ?2.34 0 25 0.16 0 32 ?1.36 0 38 0.16 14400 0 8 ?3.55 0 12 0.16 0 16 2.12 0 21 ?1.36 0 25 0.16 19200 0 6 ?6.99 0 9 ?2.34 0 12 0.16 0 15 1.73 0 19 ?2.34 28800 0 3 8.51 0 6 ?6.99 0 8 ?3.55 0 10 ?1.36 0 12 0.16 31250 0 3 0.00 0 5 0.00 0 7 0.00 0 9 0.00 0 11 0.00 38400 0 2 8.51 0 4 ?2.34 0 6 ?6.99 0 7 1.73 0 9 ?2.34 table 12.3 brr settings for various bit rates (asynchronous mode) (2) operating frequency p (mhz) 14 16 18 20 22 logical bit rate (bit/s) n n error ( % ) n n error ( % ) n n error ( % ) n n error ( % ) n n error ( % ) 110 2 123 0.23 2 141 0.03 2 159 ?0.12 2 177 ?0.25 2 194 0.16 150 2 90 0.16 2 103 0.16 2 116 0.16 2 129 0.16 2 142 0.16 300 2 45 ?0.93 2 51 0.16 2 58 ?0.69 2 64 0.16 2 71 ?0.54 600 2 22 ?0.93 1 103 0.16 1 116 0.16 1 129 0.16 1 142 0.16 1200 1 45 ?0.93 1 51 0.16 1 58 ?0.69 1 64 0.16 1 71 ?0.54 2400 1 22 ?0.93 0 207 0.16 0 233 0.16 1 32 ?1.36 1 35 ?0.54 4800 0 90 0.16 0 103 0.16 0 116 0.16 0 129 0.16 0 142 0.16 9600 0 45 ?0.93 0 51 0.16 0 58 ?0.69 0 64 0.16 0 71 ?0.54 14400 0 29 1.27 0 34 ?0.79 0 38 0.16 0 42 0.94 0 47 ?0.54 19200 0 22 ?0.93 0 25 0.16 0 28 1.02 0 32 ?1.36 0 35 ?0.54 28800 0 14 1.27 0 16 2.12 0 19 ?2.34 0 21 ?1.36 0 23 ?0.54 31250 0 13 0.00 0 15 0.00 0 17 0.00 0 19 0.00 0 21 0.00 38400 0 10 3.57 0 12 0.16 0 14 ?2.34 0 15 1.73 0 17 ?0.54
rev. 2.00, 09/04, page 343 of 720 table 12.3 brr settings for various bit rates (asynchronous mode) (3) operating frequency p (mhz) 24 25 26 28 30 logical bit rate (bit/s) n n error ( % ) n n error ( % ) n n error ( % ) n n error ( % ) n n error ( % ) 110 2 212 0.03 2 221 ?0.02 2 230 ?0.08 2 248 ?0.17 3 66 ?0.62 150 2 155 0.16 2 162 ?0.15 2 168 0.16 2 181 0.16 2 194 0.16 300 2 77 0.16 2 80 0.47 2 84 ?0.43 2 90 0.16 2 97 ?0.35 600 1 155 0.16 1 162 ?0.15 1 168 0.16 1 181 0.16 2 48 ?0.35 1200 1 77 0.16 1 80 0.47 1 84 ?0.43 1 90 0.16 1 97 ?0.35 2400 1 38 0.16 1 40 ?0.76 1 41 0.76 1 45 ?0.93 1 48 ?0.35 4800 0 155 0.16 0 162 ?0.15 0 168 0.16 0 181 0.16 0 194 0.16 9600 0 77 0.16 0 80 0.47 0 84 ?0.43 0 90 0.16 0 97 ?0.35 14400 0 51 0.16 0 53 0.47 0 55 0.76 0 60 ?0.39 0 64 0.16 19200 0 38 0.16 0 40 ?0.76 0 41 0.76 0 45 ?0.93 0 48 ?0.35 28800 0 25 0.16 0 26 0.47 0 27 0.76 0 29 1.27 0 32 ?1.36 31250 0 23 0.00 0 24 0.00 0 25 0.00 0 27 0.00 0 29 0.00 38400 0 19 ?2.34 0 19 1.73 0 20 0.76 0 22 ?0.93 0 23 1.73 table 12.3 brr settings for various bit rates (asynchronous mode) (4) operating frequency p (mhz) 32 34 36 38 40 logical bit rate (bit/s) n n error ( % ) n n error ( % ) n n error ( % ) n n error ( % ) n n error ( % ) 110 3 70 0.03 3 74 0.62 3 79 ?0.12 3 83 0.40 3 88 ?0.25 150 2 207 0.16 2 220 0.16 2 233 0.16 2 246 0.16 3 64 0.16 300 2 103 0.16 2 110 ?0.29 2 116 0.16 2 123 ?0.24 2 129 0.16 600 2 51 0.16 2 54 0.62 2 58 ?0.69 2 61 ?0.24 2 64 0.16 1200 1 103 0.16 1 110 ?0.29 1 116 0.16 1 123 ?0.24 1 129 0.16 2400 1 51 0.16 1 51 6.42 1 58 ?0.69 1 61 ?0.24 1 64 0.16 4800 0 207 0.16 0 220 0.16 0 234 ?0.27 0 246 0.16 1 32 ?1.36 9600 0 103 0.16 0 110 ?0.29 0 116 0.16 0 123 ?0.24 0 129 0.16 14400 0 68 0.64 0 73 ?0.29 0 77 0.16 0 81 0.57 0 86 ?0.22 19200 0 51 0.16 0 54 0.62 0 58 ?0.69 0 61 ?0.24 0 64 0.16 28800 0 34 ?0.79 0 36 ?0.29 0 38 0.16 0 40 0.57 0 42 0.94 31250 0 31 0.00 0 33 0.00 0 35 0.00 0 37 0.00 0 39 0.00 38400 0 25 0.16 0 27 ?1.18 0 28 1.02 0 30 ?0.24 0 32 ?1.36
rev. 2.00, 09/04, page 344 of 720 table 12.4 maximum bit rate for each f requency when using ba ud rate generator (asynchronous mode) p (mhz) n n maximum bit rate (bit/s) 4 0 0 125000 8 0 0 250000 10 0 0 312500 12 0 0 375000 14 0 0 437500 16 0 0 500000 18 0 0 562500 20 0 0 625000 22 0 0 687500 24 0 0 750000 25 0 0 781250 26 0 0 812500 28 0 0 875000 30 0 0 937500 32 0 0 1000000 34 0 0 1062500 36 0 0 1125000 38 0 0 1187500 40 0 0 1250000
rev. 2.00, 09/04, page 345 of 720 table 12.5 maximum bit rate with external clock input (asynchronous mode) p (mhz) external clock (mhz) maximum bit rate (bit/s) 4 1.0000 62500 6 1.5000 93750 8 2.0000 125000 10 2.5000 156250 12 3.0000 187500 14 3.5000 218750 16 4.0000 250000 18 4.5000 281250 20 5.0000 312500 22 5.5000 343750 24 6.0000 375000 25 6.2500 390625 26 6.5000 406250 28 7.0000 437500 30 7.5000 468750 32 8.0000 500000 34 8.5000 531250 36 9.0000 562500 38 9.5000 593750 40 10.0000 625000
rev. 2.00, 09/04, page 346 of 720 table 12.6 brr settings for various bit rates (clocked synchronous mode) (1) operating frequency p (mhz) 4 6 8 10 12 logical bit rate (bit/s) n n n n n n n n n n 250 2 124 2 187 2 249 3 77 3 93 500 1 249 2 93 2 124 2 155 2 187 1000 1 124 1 187 1 249 2 77 2 93 2500 1 49 1 74 1 99 1 124 1 149 5000 1 24 ? ? 1 49 1 61 1 74 10000 0 99 0 149 1 24 0 249 ? ? 25000 0 39 0 59 1 9 0 99 1 14 50000 0 19 0 29 1 4 0 49 0 59 100000 0 9 0 14 0 19 0 24 0 29 250000 0 3 0 5 0 7 0 9 0 11 500000 0 1 0 2 0 3 0 4 0 5 1000000 0 0 * ? ? 0 1 ? ? 0 2 2500000 ? ? ? ? ? ? 0 0 * ? ? 5000000 ? ? ? ? ? ? ? ? ? ?
rev. 2.00, 09/04, page 347 of 720 table 12.6 brr settings for various bit rates (clocked synchronous mode) (2) operating frequency p (mhz) 14 16 18 20 22 logical bit rate (bit/s) n n n n n n n n n n 250 3 108 3 124 3 140 3 155 3 171 500 2 218 2 249 3 69 3 77 3 85 1000 2 108 2 124 2 140 2 155 3 42 2500 1 174 2 49 1 224 1 249 2 68 5000 1 86 2 24 1 112 1 124 1 137 10000 1 43 1 49 1 55 1 62 1 68 25000 0 139 1 19 0 179 1 24 0 219 50000 0 69 1 9 0 89 0 99 0 109 100000 0 34 1 4 0 44 0 49 0 54 250000 0 13 1 1 0 17 0 19 0 21 500000 0 6 1 0 0 8 0 9 0 10 1000000 ? ? 0 3 ? ? 0 4 ? ? 2500000 ? ? ? ? ? ? 0 1 ? ? 5000000 ? ? ? ? ? ? 0 0 * ? ?
rev. 2.00, 09/04, page 348 of 720 table 12.6 brr settings for various bit rates (clocked synchronous mode) (3) operating frequency p (mhz) 24 25 26 28 30 logical bit rate (bit/s) n n n n n n n n n n 250 3 187 3 194 3 202 3 218 3 233 500 3 93 3 97 3 101 3 108 3 116 1000 2 187 2 194 2 202 2 218 2 233 2500 2 74 2 77 2 80 2 86 2 93 5000 1 149 1 155 1 162 1 174 1 187 10000 1 74 1 77 1 80 1 86 1 93 25000 1 29 0 249 ? ? 1 34 ? ? 50000 1 14 0 124 0 129 0 139 0 149 100000 0 59 0 62 0 64 0 69 0 74 250000 0 23 0 24 0 25 0 27 0 29 500000 0 11 ? ? 0 12 0 13 0 14 1000000 0 5 ? ? ? ? 0 6 ? ? 2500000 ? ? ? ? ? ? ? ? 0 2 5000000 ? ? ? ? ? ? ? ? ? ?
rev. 2.00, 09/04, page 349 of 720 table 12.6 brr settings for various bit rates (clocked synchronous mode) (4) operating frequency p (mhz) 32 34 36 38 40 logical bit rate (bit/s) n n n n n n n n n n 250 3 249 ? ? ? ? ? ? ? ? 500 3 124 3 132 3 140 3 147 3 155 1000 2 249 3 65 3 69 3 73 3 77 2500 2 99 2 105 2 112 2 118 2 124 5000 2 49 1 212 1 224 1 237 1 249 10000 2 24 1 105 1 112 1 118 1 124 25000 2 9 ? ? 1 44 ? ? 1 49 50000 2 4 0 169 0 179 0 189 1 24 100000 1 9 0 84 0 89 0 94 0 99 250000 1 3 0 33 0 35 0 37 0 39 500000 1 1 0 16 0 17 0 18 0 19 1000000 1 0 ? ? 0 8 ? ? 0 9 2500000 ? ? ? ? ? ? ? ? 0 3 5000000 ? ? ? ? ? ? ? ? 0 1
rev. 2.00, 09/04, page 350 of 720 table 12.7 maximum bit rate with external clock input (clocked synchronous mode) p (mhz) external clock (mhz) maximum bit rate (bit/s) 4 0.6667 666666.7 6 1.0000 1000000.0 8 1.3333 1333333.3 10 1.6667 1666666.7 12 2.0000 2000000.0 14 2.3333 2333333.3 16 2.6667 2666666.7 18 3.0000 3000000.0 20 3.3333 3333333.3 22 3.6667 3666666.7 24 4.0000 4000000.0 25 4.1667 4166666.7 26 4.3333 4333333.3 28 4.6667 4666666.7 30 5.0000 5000000.0 32 5.3333 5333333.3 34 5.6667 5666666.7 36 6.0000 6000000.0 38 6.3333 6333333.3 40 6.6667 6666666.7 [legend] ? : can be set, but there will be a degree of error. * : continuous transfer is not possible. note: settings with an error of 1 % or less are recommended.
rev. 2.00, 09/04, page 351 of 720 12.4 operation in asynchronous mode figure 12.2 shows the general format for asynchronous serial communication. one frame consists of a start bit (low level), followed by data, a parity bit, and finally stop bits (high level). in asynchronous serial communication, the transmission line is usually held in the mark state (high level). the sci monitors the communication line, and when it goes to the space state (low level), recognizes a start bit and starts serial communication. inside th e sci, the transmitter and receiver are independent units, enabling full- duplex communication. both the transmitter and the receiver also have a double-buffered structure, so that data can be read or written during transmission or reception, enabling conti nuous data transfer. lsb start bit msb idle state (mark state) stop bit 0 transmit/receive data d0 d1 d2 d3 d4 d5 d6 d7 0/1 1 1 1 1 serial data parity bit 1 bit 1 or 2 bits 7 or 8 bits 1 bit or none one unit of transfer data (character or frame) figure 12.2 data format in asynchronous communication (example with 8-bit data, parity, two stop bits) 12.4.1 data transfer format table 12.8 shows the data transfer formats that can be used in asynchronous mode. any of 12 transfer formats can be selected according to the smr setting. for details on the multiprocessor bit, refer to section 12.5, multiprocessor communication function.
rev. 2.00, 09/04, page 352 of 720 table 12.8 serial transfer formats (asynchronous mode) pe 0 0 1 1 0 0 1 1 x x x x s 8-bit data stop s 7-bit data stop s 8-bit data stop stop s 8-bit data p stop s 7-bit data stop p s 8-bit data mpb stop s 8-bit data mpb stop stop s 7-bit data stop mpb s 7-bit data stop mpb stop s 7-bit data stop stop chr 0 0 0 0 1 1 1 1 0 0 1 1 mp 0 0 0 0 0 0 0 0 1 1 1 1 stop 0 1 0 1 0 1 0 1 0 1 0 1 smr settings 123456789101112 serial transfer format and frame length stop s 8-bit data p stop s 7-bit data stop p stop legend s: start bit stop: stop bit p: parity bit mpb: multiprocessor bit x: don?t care
rev. 2.00, 09/04, page 353 of 720 12.4.2 receive data samplin g timing and reception marg in in asynchronous mode in asynchronous mode, the sci operates on a basic clock with a frequency of 16 times the bit rate. in reception, the sci samples the falling edge of the start bit using the basic clock, and performs internal synchronization. receive data is latched internally at the rising edge of the 8th pulse of the basic clock as shown in figure 12.3. thus th e reception margin in asyn chronous mode is given by formula (1) below. m = 0.5 ? 1 2n (d ? 0.5) n ? ? (l ? 0.5) f 100% ........................... formula (1) where m: reception margin ( % ) n: ratio of bit rate to clock (n = 16) d: clock duty (d = 0 to 1.0) l: frame length (l = 9 to 12) f: absolute value of clock rate deviation assuming values of f = 0 and d = 0.5 in formula (1), a reception margin is given by formula below. m = {0.5 ? 1/(2 16)} 100 [%] = 46.875% however, this is only the computed value, and a margin of 20% to 30% should be allowed in system design. internal basic clock 16 clocks 8 clocks receive data (rxd) synchronization sampling timing start bit d0 d1 data sampling timing 15 0 7 15 0 0 7 figure 12.3 receive data sampling timing in asynchronous mode
rev. 2.00, 09/04, page 354 of 720 12.4.3 clock either an internal clock generated by the on-chip baud rate generator or an external clock input at the sck pin can be selected as th e sci?s serial clock, according to the setting of the c/a bit in smr and the cke1 and cke0 bits in scr. when an external clock is input at the sck pin, the clock frequency should be 16 times the bit rate used. when the sci is operated on an internal clock, the clock can be output from the sck pin. the frequency of the clock output in this case is equal to the bit rate, and the phase is such that the rising edge of the clock is in the middle of the transmit data, as shown in figure 12.4. the clock must not be stopped during operation. 0 1 frame d0 d1 d2 d3 d4 d5 d6 d7 0/1 1 1 sck txd figure 12.4 relation between output clock and transmit data phase (asynchronous mode)
rev. 2.00, 09/04, page 355 of 720 12.4.4 sci initialization (asynchronous mode) before transmitting and receiving da ta, you should first clear the te an d re bits in scr to 0, then initialize the sci as described below. when the op erating mode, transfer format, etc., is changed, the te and re bits must be cleared to 0 before making the change using the following procedure. when the te bit is cleared to 0, the tdre flag is set to 1. note that clearing the re bit to 0 does not initialize the contents of the rdrf, per, fer, and orer flags, or the contents of rdr. when the external clock is used in asynchronous mode, the clock must be supplied even during initialization. wait yes [1] start transmission clear rie, tie, teie, mpie, * te and re bits in scr to 0 [2] no set value in brr [3] [4] [5] 1-bit interval elapsed? < initialization completion> [1] set the clock selection in scr. [2] set the data transfer format in smr and scmr. [3] write a value corresponding to the bit rate to brr. not necessary if an external clock is used. [4] set pfc of the external pin used. set rxd input during receiving and txd output during transmitting. set sck input/output according to contents set by cke1 and cke0. when cke1 and cke0 are 0 in asynchronous mode, setting the sck pin is unnecessary. outputting clocks from the sck pin starts at synchronous clock output setting. [5] wait at least one bit interval, then set the te bit or re bit in scr to 1. * at this time, the txd, rxd, and sck pins can be used. the txd pin is in a mark state during transmitting, and rxd pin is in an idle state for waiting the start bit during receiving. set data transfer format in smr set pfc of the external pin used sck, txd, rxd set rie, tie, teie, and mpie bits set te and re bits in scr to 1 set cke1 and cke0 bits in scr (te and re bits are 0) note : * in simultaneous transmit/receive operation, the te and re bits must be cleared to 0 or set to 1 simultaneously. figure 12.5 sample sci initialization flowchart
rev. 2.00, 09/04, page 356 of 720 12.4.5 data transmission (asynchronous mode) figure 12.6 shows an example of the operation for transmission in asynchronous mode. in transmission, the sci operates as described below. 1. the sci monitors the tdre flag in ssr, and if is cleared to 0, recognizes that data has been written to tdr, and transfers the data from tdr to tsr. 2. after transferring data from tdr to tsr, the sci sets the tdre flag to 1 and starts transmission. if the tie bit is set to 1 at th is time, a transmit data empty interrupt request (txi) is generated. because the txi interrupt routine writes the next transmit data to tdr before transmission of the current transmit data has finished, continuous transmission can be enabled. 3. data is sent from the txd pin in the followin g order: start bit, transmit data, parity bit or multiprocessor bit (may be omitted depending on the format), and stop bit. 4. the sci checks the tdre flag at the timing for sending the stop bit. 5. if the tdre flag is 0, the data is transferred from tdr to tsr, the stop bit is sent, and then serial transmission of the next frame is started. 6. if the tdre flag is 1, the tend flag in ssr is set to 1, the stop bit is sent, and then the ?mark state? is entered in which 1 is output. if the teie bit in scr is set to 1 at this time, a tei interrupt request is generated. figure 12.7 shows a sample flowchart fo r transmission in asynchronous mode. tdre tend 0 frame d0 d1 d7 0/1 1 0 d0 d1 d7 0/1 1 1 1 data start bit parity bit stop bit start bit data parity bit stop bit data written to tdr and tdre flag cleared to 0 in txi interrupt processing routine tei interrupt request generated idle state (mark state) txd txi interrupt request generated txi interrupt request generated figure 12.6 example of operation in transmission in asynchronous mode (example with 8-bit data, parity, one stop bit)
rev. 2.00, 09/04, page 357 of 720 no [1] yes initialization start transmission read tdre flag in ssr [2] no yes no yes read tend flag in ssr [3] no yes [4] clear dr to 0 clear te bit in scr to 0; select the txd pin as an output port with the pfc tdre = 1 all data transmitted? tend = 1 break output? [1] sci initialization: set the txd pin using the pfc. after the te bit is set to 1, 1 is output for one frame, and transmission is enabled. however, data is not transmitted. [2] sci status check and transmit data write: read ssr and check that the tdre flag is set to 1, then write transmit data to tdr and clear the tdre flag to 0. [3] serial transmission continuation procedure: to continue serial transmission, read 1 from the tdre flag to confirm that writing is possible, then write data to tdr, and then clear the tdre flag to 0. checking and clearing of the tdre flag is automatic when the dtc is activated by a transmit data empty interrupt (txi) request, and data is written to tdr. [4] break output at the end of serial transmission: to output a break in serial transmission, first clear the port data register (dr) to 0, then clear the te bit to 0 in scr and use the pfc to select the txd pin as an output port. write transmit data to tdr and clear tdre flag in ssr to 0 figure 12.7 sample serial transmission flowchart
rev. 2.00, 09/04, page 358 of 720 12.4.6 serial data recep tion (asynchronous mode) figure 12.8 shows an example of the operation for reception in asynchronous mode. in serial reception, the sci operates as described below. 1. the sci monitors the communication line, and if a start bit is detected, performs internal synchronization, receives receive data in rsr, and checks the parity bit and stop bit. 2. if an overrun error (when reception of the next data is completed while the rdrf flag is still set to 1) occurs, the oer bit in ssr is set to 1. if the rie bit in scr is set to 1 at this time, an eri interrupt request is generated. receive data is not transferred to rdr. the rdrf flag remains to be set to 1. 3. if a parity error is detected, the per bit in ss r is set to 1 and receive data is transferred to rdr. if the rie bit in scr is set to 1 at this time, an eri interrupt request is generated. 4. if a framing error (when the stop bit is 0) is detected, the fer bit in ssr is set to 1 and receive data is transferred to rdr. if the rie bit in scr is set to 1 at this time, an eri interrupt request is generated. 5. if reception finishes successfu lly, the rdrf bit in ssr is se t to 1, and receive data is transferred to rdr. if the rie bit in scr is set to 1 at this time, an rxi interrupt request is generated. because the rxi interr upt processing routine reads th e receive data transferred to rdr before reception of the next receive data has finished, continuous reception can be enabled. rdrf fer 0 1 frame d0 d1 d7 0/1 1 0 d0 d1 d7 0/1 1 1 1 data start bit parity bit stop bit start bit data parity bit stop bit eri interrupt request generated by framing error idle state (mark state) rdr data read and rdrf flag cleared to 0 in rxi interrupt processing routine rxi interrupt request generated rxd figure 12.8 example of sci operation in reception (example with 8-bit data, parity, one stop bit)
rev. 2.00, 09/04, page 359 of 720 table 12.9 shows the states of th e ssr status flags and receive da ta handling when a receive error is detected. if a receive error is detected, the rdrf flag retains its state before receiving data. reception cannot be resumed while a receive error fl ag is set to 1. accordingly, clear the oer, fer, per, and rdrf bits to 0 before resuming reception. figure 12.9 shows a sample flow chart for serial data reception. table 12.9 ssr status flag s and receive data handling ssr status flag rdrf * oer fer per receive data receive error type 1 1 0 0 lost overrun error 0 0 1 0 transferred to rdr framing error 0 0 0 1 transferred to rdr parity error 1 1 1 0 lost overrun error + framing error 1 1 0 1 lost overrun error + parity error 0 0 1 1 transferred to rdr framing error + parity error 1 1 1 1 lost overrun error + framing error + parity error note: * the rdrf flag retains its st ate before data reception.
rev. 2.00, 09/04, page 360 of 720 yes [1] no initialization start reception [2] no yes read rdrf flag in ssr [4] [5] clear re bit in scr to 0 read orer, per, and fer flags in ssr error processing (continued on next page) [3] read receive data in rdr, and clear rdrf flag in ssr to 0 no yes per fer orer = 1 rdrf = 1 all data received? [1] sci initialization: set the rxd pin using the pfc. [2] [3] receive error processing and break detection: if a receive error occurs, read the orer, per, and fer flags in ssr to identify the error. after performing the appropriate error processing, ensure that the orer, per, and fer flags are all cleared to 0. reception cannot be resumed if any of these flags are set to 1. in the case of a framing error, a break can be detected by reading the value of the input port corresponding to the rxd pin. [4] sci status check and receive data read: read ssr and check that rdrf = 1, then read the receive data in rdr and clear the rdrf flag to 0. transition of the rdrf flag from 0 to 1 can also be identified by an rxi interrupt. [5] serial reception continuation procedure: to continue serial reception, before the stop bit for the current frame is received, read the rdrf flag, read rdr, and clear the rdrf flag to 0. the rdrf flag is cleared automatically when dtc is activated by an rxi interrupt and the rdr value is read. figure 12.9 sample serial reception data flowchart (1)
rev. 2.00, 09/04, page 361 of 720 [3] error processing parity error processing yes no clear orer, per, and fer flags in ssr to 0 no yes no yes framing error processing no yes overrun error processing orer = 1 fer = 1 break? per = 1 clear re bit in scr to 0 figure 12.9 sample serial reception data flowchart (2)
rev. 2.00, 09/04, page 362 of 720 12.5 multiprocessor communication function use of the multiprocessor communication function en ables data transfer to be performed among a number of processors sharing communication lines by means of asynchronous serial communication using the multiprocessor format, in which a multiprocessor bit is added to the transfer data. when multiprocessor communicati on is carried out, each receiving station is addressed by a unique id code. the serial co mmunication cycle consis ts of two component cycles: an id transmission cycl e which specifies the receiving st ation, and a data transmission cycle. the multiprocessor bit is used to differen tiate between the id transmission cycle and the data transmission cycle. if the multiprocessor bit is 1, the cycle is an id transmission cycle, and if the multiprocessor bit is 0, the cycle is a data tr ansmission cycle. figure 12.10 shows an example of inter-processor communication using the multip rocessor format. the tran smitting station first sends the id code of the receiving station with which it wants to perform serial communication as data with a 1 multiprocessor bit added. it then sends transmit data as data with a 0 multiprocessor bit added. the receiving station sk ips data until data with a 1 multip rocessor bit is sent. when data with a 1 multiprocessor bit is recei ved, the receiving station compar es that data with its own id. the station whose id matches then receives the data sent next. stations wh ose id does not match continue to skip data until data with a 1 multiprocessor bit is again received. the sci uses the mpie bit in scr to implement this function. when the mpie bit is set to 1, transfer of receive data from rsr to rdr, error flag detection, and setting the ssr status flags, rdrf, fer, and oer to 1 are inhibited until data with a 1 multiprocesso r bit is received. on reception of receive character with a 1 multiprocessor bit, the mpbr bit in ssr is set to 1 and the mpie bit is automatically cleared, thus normal reception is resumed. if the rie bit in scr is set to 1 at this time, an rxi interrupt is generated. when the multiprocessor format is selected, the parity bit setting is invalid. all other bit settings are the same as those in no rmal asynchronous mode. the clock used for multiprocessor communication is the same as that in normal asynchronous mode.
rev. 2.00, 09/04, page 363 of 720 transmitting station receiving station a (id = 01) receiving station b (id = 02) receiving station c (id = 03) receiving station d (id = 04) serial transmission line serial data id transmission cycle = receiving station specification data transmission cycle = data transmission to receiving station specified by id (mpb = 1) (mpb = 0) h'01 h'aa [legend] mpb: multiprocessor bit figure 12.10 example of communica tion using multip rocessor format (transmission of data h'aa to receiving station a)
rev. 2.00, 09/04, page 364 of 720 12.5.1 multiprocessor seri al data transmission figure 12.11 shows a sample flowchart for multiprocessor serial data transmission. for an id transmission cycle, set the mpbt bit in ssr to 1 before transmission. for a data transmission cycle, clear the mpbt bit in ssr to 0 before transmission. all other sci operations are the same as those in asynchronous mode. no [1] yes initialization start transmission read tdre flag in ssr [2] no yes no yes read tend flag in ssr [3] no yes [4] clear dr to 0 clear te bit in scr to 0; select the txd pin as an output port with the pfc tdre = 1 all data transmitted? tend = 1 break output? clear tdre flag to 0 [1] sci initialization: set the txd pin using the pfc. after the te bit is set to 1, 1 is output for one frame, and transmission is enabled. however, data is not transmitted. [2] sci status check and transmit data write: read ssr and check that the tdre flag is set to 1, then write transmit data to tdr. set the mpbt bit in ssr to 0 or 1. finally, clear the tdre flag to 0. [3] serial transmission continuation procedure: to continue serial transmission, be sure to read 1 from the tdre flag to confirm that writing is possible, then write data to tdr, and then clear the tdre flag to 0. checking and clearing of the tdre flag is automatic when the dtc is activated by a transmit data empty interrupt (txi) request, and data is written to tdr. [4] break output at the end of serial transmission: to output a break in serial transmission, first clear the port data register (dr) to 0, then clear the te bit to 0 in scr and use the pfc to select the txd pin as an output port. write transmit data to tdr and set mpbt bit in ssr figure 12.11 sample multiprocessor serial tr ansmission flowchart
rev. 2.00, 09/04, page 365 of 720 12.5.2 multiprocessor s erial data reception figure 12.13 shows a sample flowchart for multiprocesso r serial data reception. if the mpie bit in scr is set to 1, data is skipped until data with a 1 multiprocessor bit is sent. on receiving data with a 1 multiprocessor bit, the r eceive data is transferred to rdr. an rxi interrupt request is generated at this time. all other sci operations are the same as in asynchronous mode. figure 12.12 shows an example of sci operatio n for multiprocessor format reception. mpie rdr value 0 d0 d1 d7 1 1 0 d0 d1 d7 01 1 1 data (id1) start bit mpb stop bit start bit data (data1) mpb stop bit data (id2) start bit stop bit start bit data (data2) stop bit rxi interrupt request (multiprocessor interrupt) generated idle state (mark state) rdrf rdr data read and rdrf flag cleared to 0 in rxi interrupt processing routine if not this station?s id, mpie bit is set to 1 again rxi interrupt request is not generated, and rdr retains its state id1 (a) data does not match station?s id mpie rdr value 0 d0 d1 d7 1 1 0 d0 d1 d7 01 1 1 mpb mpb rxi interrupt request (multiprocessor interrupt) generated idle state (mark state) rdrf rdr data read and rdrf flag cleared to 0 in rxi interrupt processing routine matches this station?s id, so reception continues, and data is received in rxi interrupt processing routine mpie bit is set to 1 again id2 (b) data matches station?s id data2 id1 mpie = 0 mpie = 0 figure 12.12 example of sci operation in reception (exampl e with 8-bit data, multiprocessor bit, one stop bit)
rev. 2.00, 09/04, page 366 of 720 yes [1] no initialization start reception no yes [4] clear re bit in scr to 0 error processing (continued on next page) [5] no yes fer orer = 1 rdrf = 1 all data received? set mpie bit in scr to 1 [2] read orer and fer flags in ssr read rdrf flag in ssr [3] read receive data in rdr no yes this station?s id? read orer and fer flags in ssr yes no read rdrf flag in ssr no yes fer orer = 1 read receive data in rdr rdrf = 1 [1] sci initialization: set the rxd pin using the pfc. [2] id reception cycle: set the mpie bit in scr to 1. [3] sci status check, id reception and comparison: read ssr and check that the rdrf flag is set to 1, then read the receive data in rdr and compare it with this station?s id. if the data is not this station?s id, set the mpie bit to 1 again, and clear the rdrf flag to 0. if the data is this station?s id, clear the rdrf flag to 0. [4] sci status check and data reception: read ssr and check that the rdrf flag is set to 1, then read the data in rdr. [5] receive error processing and break detection: if a receive error occurs, read the orer and fer flags in ssr to identify the error. after performing the appropriate error processing, ensure that the orer and fer flags are all cleared to 0. reception cannot be resumed if either of these flags is set to 1. in the case of a framing error, a break can be detected by reading the rxd pin value. figure 12.13 sample multiprocessor serial reception flowchart (1)
rev. 2.00, 09/04, page 367 of 720 error processing yes no clear orer and fer flags in ssr to 0 no yes no yes framing error processing overrun error processing orer = 1 fer = 1 break? clear re bit in scr to 0 [5] figure 12.13 sample multiprocessor serial reception flowchart (2)
rev. 2.00, 09/04, page 368 of 720 12.6 operation in clocked synchronous mode figure 12.14 shows the general format for clocked synchronous communication. in clocked synchronous mode, data is transmitted or received in synchronization with clock pulses. data is transferred in 8-bit units. in clocked synchronous serial communication, data on the transmission line is output from one falling edge of the serial clock to the next. in clocked synchronous mode, the sci receives data in synchroniza tion with the rising edge of the se rial clock. after 8-bit data is output, the transmission line holds the msb state. in clocked synchronous mode, no parity or multiprocessor bit is added. in side the sci, the transmitter and receiver are independent units, enabling full-duplex communication by use of a common clock. both the transmitter and the receiver also have a double-buffered structure, so that data can be r ead or written during transmission or reception, enab ling continuous data transfer. don?t care don?t care one unit of transfer data (character or frame) bit 0 serial data synchronization clock bit 1 bit 3 bit 4 bit 5 lsb msb bit 2 bit 6 bit 7 * * note: * high except in continuous transfer figure 12.14 data format in clocked synchronous communication (for lsb-first) 12.6.1 clock either an internal clock generated by the on-chip baud rate generator or an external synchronization clock input at the sck pin can be selected, according to the setting of cke1 and cke0 bits in scr. when the sci is operated on an internal clock, the serial clock is output from the sck pin. eight serial clock pulses are output in the transfer of one character, and when no transfer is performed, the clock is fixed high. only in reception, the serial clock is continued generating until an overrun error is occurred or the re bit is cleared to 0. to execute reception in one-character units, select an ex ternal clock as a clock source. 12.6.2 sci initialization (clocked synchronous mode) before transmitting and receiving da ta, you should first clear the te an d re bits in scr to 0, then initialize the sci as described in a sample flowchar t in figure 12.15. when the operating mode, transfer format, etc., is changed, the te and re bits must be cleared to 0 before making the change using the following procedure. when the te b it is cleared to 0, the tdre flag is set to 1. note that clearing the re bit to 0 does not initialize the rdrf, per, fer, and orer flags, or the contents of rdr.
rev. 2.00, 09/04, page 369 of 720 wait no yes start initialization set data transfer format in smr set value in brr clear rie, tie, teie, mpie, te and re bits in scr to 0 * [2] [3] [4] [5] 1-bit interval elapsed? set pfc of the external pin used sck, txd, rxd set cke1 and cke0 bits in scr (te and re bits are 0) [1] [1] set the clock selection in scr. [2] set the data transfer format in smr. [3] write a value corresponding to the bit rate to brr. not necessary if an external clock is used. [4] set pfc of the external pin used. set rxd input during receiving and txd output during transmitting. set sck input/output according to contents set by cke1 and cke0. [5] wait at least one bit interval, then set the te bit or re bit in scr to 1. * at this time, the txd, rxd, and sck pins can be used. the txd pin is in a mark state during transmitting. when synchronous clock output (clock master) is set during receiving in synchronous mode, outputting clocks from the sck pin starts. note: * in simultaneous transmit and receive operations, the te and re bits should both be cleared to 0 or set to 1 simultaneously. set rie, tie, and teie bits set te and re bits in scr to 1 figure 12.15 sample sci initialization flowchart 12.6.3 serial data transmission (clocked synchronous mode) figure 12.16 shows an example of sci operation for transmission in clocked synchronous mode. in serial transmission, the sci operates as described below. 1. the sci monitors the tdre flag in ssr, and if it is cleared to 0, recognizes that data has been written to tdr, and transfers the data from tdr to tsr. 2. after transferring data from tdr to tsr, the sci sets the tdre flag to 1 and starts transmission. if the tie bit in scr is set to 1 at this time, a transmit data empty (txi) interrupt request is generated. because the txi interrupt routine writes the next transmit data to tdr before transmission of the current tran smit data has finished, continuous transmission can be enabled. 3. 8-bit data is sent from the txd pin synchronized with the output clock when output clock mode has been specified and synchronized with the input clock when use of an external clock has been specified.
rev. 2.00, 09/04, page 370 of 720 4. the sci checks the tdre flag at the timing for sending the msb (bit 7). 5. if the tdre flag is cleared to 0, data is tr ansferred from tdr to tsr, and serial transmission of the next frame is started. 6. if the tdre flag is set to 1, the tend flag in ssr is set to 1, and the txd pin maintains the output state of the last bit. if the teie bit in scr is set to 1 at this time, a tei interrupt request is generated. the sck pin is fixed high. figure 12.17 shows a sample flowchart for serial data transmission. even if the tdre flag is cleared to 0, transmission will not start while a receive error flag (ore r, fer, or per) is set to 1. make sure to clear the receive error flags to 0 befo re starting transmission. note that clearing the re bit to 0 does not clear the receive error flags. transfer direction bit 0 serial data synchroniza- tion clock 1 frame tdre tend bit 1 bit 0 bit 4 bit 5 bit 6 bit 7 txi interrupt request generated data written to tdr and tdre flag cleared to 0 in txi interrupt processing routine tei interrupt request generated txi interrupt request generated figure 12.16 sample sci transmission operation in clocked synchronous mode
rev. 2.00, 09/04, page 371 of 720 no [1] yes initialization start transmission read tdre flag in ssr [2] write transmit data to tdr and clear tdre flag in ssr to 0 no yes no yes read tend flag in ssr [3] clear te bit in scr to 0 tdre = 1 all data transmitted? tend = 1 [1] sci initialization: set the txd pin using the pfc. [2] sci status check and transmit data write: read ssr and check that the tdre flag is set to 1, then write transmit data to tdr and clear the tdre flag to 0. [3] serial transmission continuation procedure: to continue serial transmission, be sure to read 1 from the tdre flag to confirm that writing is possible, then write data to tdr, and then clear the tdre flag to 0. checking and clearing of the tdre flag is automatic when the dtc is activated by a transmit data empty interrupt (txi) request and data is written to tdr. figure 12.17 sample serial transmission flowchart
rev. 2.00, 09/04, page 372 of 720 12.6.4 serial data reception (clocked synchronous mode) figure 12.18 shows an ex ample of sci operation for reception in clocked synchronous mode. in serial reception, the sci operates as described below. 1. the sci performs internal initialization in synchronization with a synchronization clock input or output, starts receiving data, an d stores the received data in rsr. 2. if an overrun error (when reception of the next data is completed while the rdrf flag is still set to 1) occurs, the orer bit in ssr is set to 1. if the rie bit in scr is set to 1 at this time, an eri interrupt request is generated. receive da ta is not transferred to rdr. the rdrf flag remains to be set to 1. 3. if reception finishes successfu lly, the rdrf bit in ssr is se t to 1, and receive data is transferred to rdr. if the rie bit in scr is set to 1 at this time, an rxi interrupt request is generated. because the rxi interrupt processing routine reads the receive data transferred to rdr before reception of the next receive da ta has finished, continuous reception can be enabled. bit 7 serial data synchroniza- tion clock 1 frame rdrf orer bit 0 bit 7 bit 0 bit 1 bit 6 bit 7 rxi interrupt request generated rdr data read and rdrf flag cleared to 0 in rxi interrupt processing routine eri interrupt request generated by overrun error rxi interrupt request generated figure 12.18 example of sci operation in reception
rev. 2.00, 09/04, page 373 of 720 reception cannot be resumed while a receive error fl ag is set to 1. accordingly, clear the orer, fer, per, and rdrf bits to 0 before resuming reception. figure 12.19 shows a sample flowchart for serial data reception. yes [1] no initialization start reception [2] no yes read rdrf flag in ssr [4] [5] clear re bit in scr to 0 error processing (continued below) [3] read receive data in rdr, and clear rdrf flag in ssr to 0 no yes orer = 1 rdrf = 1 all data received? read orer flag in ssr error processing overrun error processing clear orer flag in ssr to 0 [3] [1] sci initialization: set the rxd pin using the pfc. [2] [3] receive error processing: if a receive error occurs, read the orer flag in ssr, and after performing the appropriate error processing, clear the orer flag to 0. transfer cannot be resumed if the orer flag is set to 1. [4] sci status check and receive data read: read ssr and check that the rdrf flag is set to 1, then read the receive data in rdr and clear the rdrf flag to 0. transition of the rdrf flag from 0 to 1 can also be identified by an rxi interrupt. [5] serial reception continuation procedure: to continue serial reception, before the msb (bit 7) of the current frame is received, reading the rdrf flag, reading rdr, and clearing the rdrf flag to 0 should be finished. the rdrf flag is cleared automatically when the dtc is activated by a receive data full interrupt (rxi) request and the rdr value is read. figure 12.19 sample serial reception flowchart
rev. 2.00, 09/04, page 374 of 720 12.6.5 simultaneous serial data transmission and recep tion (clocked synchronous mode) figure 12.20 shows a samp le flowchart for simultane ous serial transmit an d receive operations. the following procedure should be used for simultaneous serial data transmit and receive operations after the sci initialization. to switch from transmit mode to simultaneous transmit and receive mode, after checking that the sci has fi nished transmission and the tdre and tend flags are set to 1, clear te to 0. then simultaneous ly set te and re to 1 with a single instruction. to switch from receive mode to simultaneous transmit and receive mode, after checking that the sci has finished reception, clear re to 0. then after checking that the rdrf and receive error flags (orer, fer, and per) are cleared to 0, si multaneously set te and re to 1 with a single instruction.
rev. 2.00, 09/04, page 375 of 720 yes [1] no initialization start transmission/reception [5] error processing [3] no yes orer = 1 all data received? [2] read tdre flag in ssr no yes tdre = 1 write transmit data to tdr and clear tdre flag in ssr to 0 no yes rdrf = 1 read orer flag in ssr [4] read rdrf flag in ssr [1] sci initialization: set the txd and rxd pins using the pfc. [2] sci status check and transmit data write: read ssr and check that the tdre flag is set to 1, then write transmit data to tdr and clear the tdre flag to 0. transition of the tdre flag from 0 to 1 can also be identified by a txi interrupt. [3] receive error processing: if a receive error occurs, read the orer flag in ssr, and after performing the appropriate error processing, clear the orer flag to 0. transmission/reception cannot be resumed if the orer flag is set to 1. [4] sci status check and receive data read: read ssr and check that the rdrf flag is set to 1, then read the receive data in rdr and clear the rdrf flag to 0. transition of the rdrf flag from 0 to 1 can also be identified by an rxi interrupt. [5] serial transmission/reception continuation procedure: to continue serial transmission/ reception, before the msb (bit 7) of the current frame is received, finish reading the rdrf flag, reading rdr, and clearing the rdrf flag to 0. also, before the msb (bit 7) of the current frame is transmitted, read 1 from the tdre flag to confirm that writing is possible. then write data to tdr and clear the tdre flag to 0. checking and clearing of the tdre flag is automatic when the dtc is activated by a transmit data empty interrupt (txi) request and data is written to tdr. also, the rdrf flag is cleared automatically when the dtc is activated by a receive data full interrupt (rxi) request and the rdr value is read. note: when switching from transmit or receive operation to simultaneous transmit and receive operations, first clear the te bit and re bit to 0, then set both these bits to 1 simultaneously. clear te and re bits in scr to 0 read receive data in rdr, and clear rdrf flag in ssr to 0 figure 12.20 sample flowchart of simultaneo us serial transmit and receive operations
rev. 2.00, 09/04, page 376 of 720 12.7 sci interrupts 12.7.1 interrupts in normal seri al communication interface mode table 12.10 shows the interrupt sources in no rmal serial communication interface mode. a different interrupt vector is assigned to each interrupt source, and individual interrupt sources can be enabled or disabled using the enable bits in scr. when the tdre flag in ssr is set to 1, a txi interrupt request is generated. when the tend flag in ssr is set to 1, a tei interrupt request is generated. a txi interrupt request can activate the dtc to perform data tr ansfer. the tdre flag is cleared to 0 automatically when data transfer is performed by the dtc. when the rdrf flag in ssr is set to 1, an rxi interrupt request is generated. when the orer, per, or fer flag in ssr is set to 1, an eri in terrupt request is genera ted. an rxi interrupt request can activate the dtc to perform data transfer. the rdrf fl ag is cleared to 0 automatically when data transfer is performed by the dtc. a tei interrupt is generated when the tend flag is set to 1 while the teie bit is set to 1. if a tei interrupt and a txi interrupt are generated simultaneously, the txi interrupt has priority for acceptance. however, note that if the tdre an d tend flags are cleared simultaneously by the txi interrupt routine, the sci cannot bran ch to the tei interrupt routine later. table 12.10 sci interrupt sources channel name interrupt source interrupt flag dtc activation eri_2 receive error orer, fer, per not possible rxi_2 receive data full rdrf possible txi_2 transmit data empty tdre possible 2 tei_2 transmission end tend not possible eri_3 receive error orer, fer, per not possible rxi_3 receive data full rdrf possible txi_3 transmit data empty tdre possible 3 tei_3 transmission end tend not possible eri_4 receive error orer, fer, per not possible rxi_4 receive data full rdrf possible txi_4 transmit data empty tdre possible 4 tei_4 transmission end tend not possible
rev. 2.00, 09/04, page 377 of 720 12.8 usage notes 12.8.1 tdr write and tdre flag the tdre bit in the serial status register (ssr) is a status flag indicating transferring of transmit data from tdr into tsr. the sci sets the tdre bit to 1 when it transfers data from tdr to tsr. data can be written to tdr regardless of the tdre bit status. if new data is written in tdr when tdre is 0, however, the old data stored in tdr will be lost because the data has not yet been tr ansferred to tsr. before writing transmit data to tdr, be sure to check that the tdre bit is set to 1. 12.8.2 module standby mode setting sci operation can be disabled or enabled using the module standby control register. the initial setting is for sci operation to be halted. regist er access is enabled by clearing module standby mode. for details, refer to section 24, power-down modes. 12.8.3 break detection and proces sing (asynchronous mode only) when framing error detection is performed, a break can be detected by reading the rxd pin value directly. in a break, the input from the rxd pin becomes all 0s, and so the fer flag is set, and the per flag may also be set. note that, since the sci continues the receive operation after receiving a break, even if the fer flag is cleared to 0, it will be set to 1 again. 12.8.4 sending a break signal (asynchronous mode only) the txd pin becomes of the i/o port general i/o pin with the i/o direction and level determined by the port data register (dr) and the port i/o register (ior) of the pin function controller (pfc). these conditions allow break signals to be sent. the dr value is substituted for the marking status until the pfc is set. consequently, the output port is set to initially output a 1. to send a break in serial transmission, first clear the dr to 0, then establish the txd pin as an output port using the pfc. when the te bit is cleared to 0, the transmission section is initialized regardless of the present transmission status.
rev. 2.00, 09/04, page 378 of 720 12.8.5 receive error flags and transmit op erations (clocked synchronous mode only) transmission cannot be started when a receive error flag (orer, per, or fer) is set to 1, even if the tdre flag is cleared to 0. be sure to clear the receive error flags to 0 before starting transmission. note also that recei ve error flags cannot be cleared to 0 even if the re bit is cleared to 0. 12.8.6 constraints on dtc use 1. when using an external clock source for the se rial clock, update tdr with the dtc, and then after the elapse of five peripheral clocks (p ) or more, input a transmit clock. if a transmit clock is input in the first four p clocks after tdr is written, an error may occur (figure 12.21). 2. before reading the receive da ta register (rdr) with the dt c, select the receive-data-full (rxi) interrupt of the sci as a start-up source. d0 sck tdre d1 d2 d3 d4 d5 d6 d7 t note: during external clock operation, an error may occur if t is 4 p clocks or less. figure 12.21 example of clocked synchronous transmission with dtc 12.8.7 cautions on clocked sy nchronous external clock mode 1. set te = re = 1 only when external clock sck is 1. 2. do not set te = re = 1 until at least four p clocks after external clock sck has changed from 0 to 1. 3. when receiving, rdrf is 1 when re is cleared to 0 after 2.5?3.5 p clocks from the rising edge of the rxd d7 bit sck input, but copying to rdr is not possible. 12.8.8 caution on clocked synchronous internal clock mode when receiving, rdrf is 1 when re is cleared to 0 after 1.5 p clocks from the rising edge of the rxd d7 bit sck output, but copying to rdr is not possible.
rev. 2.00, 09/04, page 379 of 720 section 13 a/d converter this lsi includes a successive approximation type 10-bit a/d converter. the block diagram of the a/d converter is shown in figure 13.1. 13.1 features ? 10-bit resolution ? input channels 16 channels (two independent a/d conversion modules) ? conversion time: 6.7 s per channel (at p = 20 mhz operation), 5.4 s (during p = 25 mhz operation) ? three operating modes ? single mode: single-channel a/d conversion ? continuous scan mode: repetitive a/d conversion on 1 to 8 channels ? single-cycle scan mode: continuous a/d conversion on 1 to 8 channels ? data registers ? conversion results are held in a 16- bit data register for each channel ? sample and hold function ? three methods for conversion start ? software ? conversion start trigger from multifunction timer pulse unit (mtu) or motor management timer (mmt) ? external trigger signal ? interrupt request ? an a/d conversion end interrupt request (adi) can be generated ? module stop mode can be set
rev. 2.00, 09/04, page 380 of 720 module data bus control circuit internal data bus 10-bit d/a comparator + sample-and- hold circuit adi interrupt signal bus interface successive approximations register multiplexer addrm    addrn adcsr adcr adtsr anm       ann [legend] adcr: a/d control register adcsr: a/d control/status register adtsr: a/d trigger select register addrm to addrn: a/d data register m to n note: the register number corresponds to the channel number of the module. (note that for : m = 0, n = 15) adtrg conversion start trigger from mtu/mmt p /4 p /8 p /16 p /32 av cc av ss figure 13.1 block diagram of a/d converter (for one module)
rev. 2.00, 09/04, page 381 of 720 13.2 input/output pins table 13.1 summarizes the input pins used by the a/d converter. this lsi has two a/d conversion modules, each of which can be operated independently. the input channels are divided into four channel sets. table 13.1 pin configuration module type pin name i/o function common av cc input analog block power supply and reference voltage av ss input analog block ground and reference voltage adtrg input a/d external trigger input pin an0 input analog input pin 0 group 0 a/d module 0 (a/d0) an1 input analog input pin 1 an2 input analog input pin 2 an3 input analog input pin 3 an8 input analog input pin 8 group 1 an9 input analog input pin 9 an10 input analog input pin 10 an11 input analog input pin 11 an4 input analog input pin 4 group 0 a/d module 1 (a/d1) an5 input analog input pin 5 an6 input analog input pin 6 an7 input analog input pin 7 an12 input analog input pin 12 group 1 an13 input analog input pin 13 an14 input analog input pin 14 an15 input analog input pin 15 note: the connected a/d module differs for each pin. the control registers of each module must be set.
rev. 2.00, 09/04, page 382 of 720 13.3 register description the a/d converter has the following registers. for details on register addresses, refer to appendix a, internal i/o register. ? a/d data register 0 (h/l) (addr0) ? a/d data register 1 (h/l) (addr1) ? a/d data register 2 (h/l) (addr2) ? a/d data register 3 (h/l) (addr3) ? a/d data register 4 (h/l) (addr4) ? a/d data register 5 (h/l) (addr5) ? a/d data register 6 (h/l) (addr6) ? a/d data register 7 (h/l) (addr7) ? a/d data register 8 (h/l) (addr8) ? a/d data register 9 (h/l) (addr9) ? a/d data register 10 (h/l) (addr10) ? a/d data register 11 (h/l) (addr11) ? a/d data register 12 (h/l) (addr12) ? a/d data register 13 (h/l) (addr13) ? a/d data register 14 (h/l) (addr14) ? a/d data register 15 (h/l) (addr15) ? a/d control/status register_0 (adcsr_0) ? a/d control/status register_1 (adcsr_1) ? a/d control register_0 (adcr_0) ? a/d control register_1 (adcr_1) ? a/d trigger select register (adtsr) 13.3.1 a/d data registers 0 to 15 (addr0 to addr15) addrs are 16-bit read-only registers. the conversion result for each analog input channel is stored in addr with the corresponding number. (for example, the conversion result of an4 is stored in addr4.) the converted 10-bit data is stored in bits 6 to 15. the lower 6 bits are always read as 0. the data bus between the cpu and the a/d converter is 8 bits wide. the upper byte can be read directly from the cpu, however the lower byte should be r ead via a temporary register. the temporary register conten ts are transferred from the addr wh en the upper byte data is read. when reading the addr, read the upper byte before the lower byte, or read in word unit. the initial value of addr is h'0000.
rev. 2.00, 09/04, page 383 of 720 13.3.2 a/d control/status registers 0, 1 (adcsr_0, adcsr_1) adcsr for each module controls a/d conversion operations. bit bit name initial value r/w description 7 adf 0 r/(w) * a/d end flag a status flag that indicates the end of a/d conversion. [setting conditions] ? when a/d conversion ends in single mode ? when a/d conversion ends on all specified channels in scan mode [clearing conditions] ? when 0 is written after reading adf = 1 ? when the dtc is activated by an adi interrupt and addr is read with the disel bit in dtmr of dtc = 0 6 adie 0 r/w a/d interrupt enable the a/d conversion end interrupt (adi) request is enabled when 1 is set when changing the operating mode, first clear the adst bit in the a/d control registers (adcrs) to 0. 5 4 adm1 adm0 0 0 r/w r/w a/d mode 1 and 0 select the a/d conversion mode. 00: single mode 01: 4-channel scan mode 10: 8-channel scan mode 11: setting prohibited when changing the operating mode, first clear the adst bit in the a/d control registers (adcrs) to 0. 3 ? 1 r reserved this bit is always read as 1, and should only be written with 1. 2 1 0 ch2 ch1 ch0 0 0 0 r/w r/w r/w channel select 2 to 0 select analog input channels. see table 13.2. when changing the operating mode, first clear the adst bit in the a/d control registers (adcrs) to 0. note: * only 0 can be written to clear the flag.
rev. 2.00, 09/04, page 384 of 720 table 13.2 channel select list analog input channels bit 2 bit 1 bit 0 single mode 4-channel scan mode * 2 ch2 ch1 ch0 a/d0 a/d1 a/d0 a/d1 0 0 0 an0 an4 an0 an4 1 an1 an5 an0, an1 an4, an5 1 0 an2 an6 an0 to an2 an4 to an6 1 an3 an7 an0 to an3 an4 to an7 1 0 0 an8 an12 an8 an12 1 an9 an13 an8, an9 an12, an13 1 0 an10 an14 an8 to an10 an12 to an14 1 an11 an15 an8 to an11 an12 to an15 analog input channels bit 2 bit 1 bit 0 8-channel scan mode * 2 ch2 ch1 ch0 a/d0 a/d1 0 * 1 0 0 an0, an8 an4, an12 1 an0, an1, an8, an9 an4, an5, an12, an13 1 0 an0 to an2, an8 to an10 an4 to an6, an12 to an14 1 an0 to an3, an8 to an11 an4 to an7, an12 to an15 notes: 1. in 8-channel scan mode, the ch2 bit must be cleared to 0. 2. continuous scan mode or single-cycle scan mode can be selected with the adcs bit. 13.3.3 a/d control registers 0, 1 (adcr_0, adcr_1) adcr for each module controls a/d conversion starte d by an external trigger signal and selects the operating clock.
rev. 2.00, 09/04, page 385 of 720 bit bit name initial value r/w description 7 trge 0 r/w trigger enable enables or disables triggering of a/d conversion by adtrg , an mtu trigger, or an mmt trigger. 0: a/d conversion triggering is disabled 1: a/d conversion triggering is enabled 6 5 cks1 cks0 0 0 r/w r/w clock select 0 and 1 select the a/d conversion time. 00: p /32 01: p /16 10: p /8 11: p /4 when changing the a/d conversion time, first clear the adst bit in the a/d control registers (adcrs) to 0. cks[1,0] = b'11 can be set while p 25 mhz. 4 adst 0 r/w a/d start starts or stops a/d conversion. when this bit is set to 1, a/d conversion is started. when this bit is cleared to 0, a/d conversion is stopped an d the a/d converter enters the idle state. in single or single-cycle scan mode, this bit is automatically cleared to 0 when a/d conversion ends on the selected single channel. in continuous scan mode, a/d conversion is continuously performed for the selected channels in sequence until this bit is cleared by a software, reset, or in software standby mode, hardware standby mode, or module standby mode. 3 adcs 0 r/w a/d continuous scan selects either single-cycle sc an or continuous scan in scan mode. this bit is valid only when scan mode is selected. 0: single-cycle scan 1: continuous scan when changing the operating mode, first clear the adst bit in the a/d control registers (adcrs) to 0. 2 to 0 ? all 1 r reserved these bits are always read as 1, and should only be written with 1.
rev. 2.00, 09/04, page 386 of 720 13.3.4 a/d trigger select register (adtsr) the adtsr enables an a/d conversion st arted by an external trigger signal. bit bit name initial value r/w description 7 to 4 ? all 0 r reserved these bits are always read as 0, and should only be written with 0. 3 2 trg1s1 trg1s0 0 0 r/w r/w ad trigger 1 select 1 and 0 enable the start of a/d conver sion by a/d1 with a trigger signal. 00: a/d conversion start by external trigger pin ( adtrg ) or mtu trigger is enabled 01: a/d conversion start by external trigger pin ( adtrg ) is enabled 10: a/d conversion start by mtu trigger is enabled 11: a/d conversion start by mmt trigger is enabled when changing the operating mode, first clear the trge and adst bit in the a/d control registers (adcrs) to 0. 1 0 trg0s1 trg0s0 0 0 r/w r/w ad trigger 0 select 1 and 0 enable the start of a/d conver sion by a/d0 with a trigger signal. 00: a/d conversion start by external trigger pin ( adtrg ) or mtu trigger is enabled 01: a/d conversion start by external trigger pin ( adtrg ) is enabled 10: a/d conversion start by mtu trigger is enabled 11: a/d conversion start by mmt trigger is enabled when changing the operating mode, first clear the trge and adst bit in the a/d control registers (adcrs) to 0.
rev. 2.00, 09/04, page 387 of 720 13.4 operation the a/d converter operates by su ccessive approximation with 10-b it resolution. it has two operating modes; single mode and scan mode. there are two kinds of scan mode: continuous mode and single-cycle mode. when changing the operating mode or analog input channel, in order to prevent incorrect operation, first clear the adst bit to 0 in adcr. the adst bit can be set at the same time when the operating mode or analog input channel is changed. 13.4.1 single mode in single mode, a/d conversion is to be performed only once on the specified single channel. the operations are as follows. 1. a/d conversion is started when the adst bit in adcr is set to 1, according to software, mtu, mmt, or external trigger input. 2. when a/d conversion is completed, the re sult is transferred to the a/d data register corresponding to the channel. 3. on completion of conversion, the adf bit in adcsr is set to 1. if the adie bit is set to 1 at this time, an adi interrupt request is generated. 4. the adst bit remains set to 1 during a/d conversion. when a/d conversion ends, the adst bit is automatically cleared to 0 and th e a/d converter enters the idle state. when the adst bit is cleared to 0 during a/d conversion, a/d conversion stops and the a/d converter enters the idle state. 13.4.2 continuous scan mode in continuous scan mode, a/d conversion is to be performed sequentially on the specified channels (eight channels maximum). the operations are as follows. 1. when the adst bit in adcr is set to 1 by software, mtu, mmt, or external trigger input, a/d conversion starts on the channel with the lowest number in the group (an0, an1, ..., an3). 2. when a/d conversion for each channel is comple ted, the result is sequentially transferred to the a/d data register corresponding to each channel. 3. when conversion of all the selected channels is completed, the adf bit in adcsr is set to 1. if the adie bit is set to 1 at this time, an adi interrupt is requested after a/d conversion ends. conversion of the first channe l in the group starts again. 4. steps 2 to 3 are repeated as long as the ads t bit remains set to 1. when the adst bit is cleared to 0, a/d conversion stops and th e a/d converter enters the idle state.
rev. 2.00, 09/04, page 388 of 720 13.4.3 single-cycle scan mode in single-cycle scan mode, a/d conversion is to be performed once on the specified channels (eight channels maximum). operations are as follows. 1. when the adst bit in adcr is set to 1 by a software, mtu, mmt, or external trigger input, a/d conversion starts on the channel with the lowest number in the group (an0, an1, ..., an3). 2. when a/d conversion for each channel is completed, the result is sequentially transferred to the a/d data register corresponding to each channel. 3. when conversion of all the selected channels is completed, the adf bit in adcsr is set to 1. if the adie bit is set to 1 at this time, an adi interrupt is requested after a/d conversion ends. 4. after a/d conversion ends, the adst bit is automatically cleared to 0 and the a/d converter enters the idle state. when the adst bit is cleared to 0 during a/d conversion, a/d conversion stops and the a/d converter enters the idle state. 13.4.4 input sampling and a/d conversion time the a/d converter has a built-in sample-and-hold circuit for each module. the a/d converter samples the analog input when the a/d conversion start delay time (t d ) has passed after the adst bit in adcr is set to 1, then starts conversion. figure 13.2 shows the a/d conversion timing. table 13.3 shows the a/d conversion time. as indicated in figure 13.2, the a/d conversion time (t conv ) includes t d and the input sampling time (t spl ). the length of t d varies depending on the timing of the write access to adcr. the total conversion time therefore varies within the ranges indicated in table 13.3. in scan mode, the values given in table 13.3 apply to the first conversion time. the values given in table 13.4 apply to the second and subsequent conversions.
rev. 2.00, 09/04, page 389 of 720 p a/d converter a/d conversion a/d conversion start delay time(t d ) a/d conversion time (t conv ) analog input sampling time(t spl ) adst write timing end of a/d conversion adf address write cycle a/d synchronization time (3 states) (up to 59 states) internal write signal analog input sampling signal idle state sample-and-hold figure 13.2 a/d conversion timing table 13.3 a/d conversio n time (single mode) cks1 = 0 cks1 = 1 cks0 = 0 cks0 = 1 cks0 = 0 cks0 = 1 item symbol min typ max min typ max min typ max min typ max a/d conversion start delay time t d 31 ? 62 15 ? 30 7 ? 14 3 ? 6 input sampling time t spl ? 256 ? ? 128 ? ? 64 ? ? 32 ? a/d conversion time t conv 1024 ? 1055 515 ? 530 259 ? 266 131 ? 134 note: all values represent the number of states for p .
rev. 2.00, 09/04, page 390 of 720 table 13.4 a/d conversion time (scan mode) cks1 cks0 conversion time (state) 0 1024 (fixed) 0 1 512 (fixed) 0 256 (fixed) 1 1 128 (fixed) 13.4.5 a/d converter activation by mtu or mmt the a/d converter can be independently activated by an a/d conversion request from the interval timer of the mtu or mmt. to activate the a/d converter by the mtu or mmt, set the a/d trigger select register (adtsr). after this register setting has been made, the adst bit in adcr is automatically set to 1 when an a/d conversion request from the interval timer of the mtu or mmt occurs. the timing from setting of the adst bit until the start of a/d conver sion is the same as when 1 is written to the adst bit by software. 13.4.6 external tr igger input timing a/d conversion can be externally triggered. when the trgs0 and trgs1 bits are set to 00 or 01 in adtsr, external trigger input is enabled at the adtrg pin. a falling edge of the adtrg pin sets the adst bit to 1 in adcr, starting a/d conversion. other operations, in both single and scan modes, are the same as when the adst bit ha s been set to 1 by software. figure 13.3 shows the timing. ck adtrg external trigger signal adst a/d conversion figure 13.3 external trigger input timing
rev. 2.00, 09/04, page 391 of 720 13.5 interrupt sources and dtc transfer requests the a/d converter generates an a/d conversion end interrupt (adi) upon the completion of a/d conversion. adi interrupt requests are enabled when the adie bit is set to 1 while the adf bit in adcsr is set to 1 after a/d conversion is comple ted. the data transfer controller (dtc) can be activated by an adi interrupt. having the convert ed data read by the dtc in response to an adi interrupt enables continuous conversion to be achieved without imposing a load on software. the a/d converter can generate an a/d conversion end interrupt request. the adi interrupt can be enabled by setting the adie bit in the a/d contro l/status register (adcsr) to 1, or disabled by clearing the adie bit to 0. the dt c can be activated by an adi interrupt. in this case an interrupt request is not sent to the cpu. when the dtc is activated by an adi interrupt, the adf bit in adcsr is automatically cleared when data is transferred by the dtc. table 13.5 a/d converter interrupt source name interrupt source interrupt source flag dtc activation adi a/d conversion completed adf possible
rev. 2.00, 09/04, page 392 of 720 13.6 definitions of a/d conversion accuracy this lsi's a/d conversion accuracy definitions are given below. ? resolution the number of a/d converter digital output codes ? quantization error the deviation inherent in the a/d converter, given by 1/2 lsb (see figure 13.4). ? offset error the deviation of the analog input voltage valu e from the ideal a/d conversion characteristic when the digital output changes from the minimum voltage value b'0000000000 (h'000) to b'0000000001 (h'001) (see figure 13.5). ? full-scale error the deviation of the analog input voltage valu e from the ideal a/d conversion characteristic when the digital output changes from b'1111111110 (h'3fe) to b'1111111111 (h'3ff) (see figure 13.5). ? nonlinearity error the error with respect to the ideal a/d convers ion characteristic between zero voltage and full- scale voltage. does not include offset error, fu ll-scale error, or quanti zation error (see figure 13.5). ? absolute accuracy the deviation between the digital value and the analog input value. includes offset error, full- scale error, quantization erro r, and nonlinearity error.
rev. 2.00, 09/04, page 393 of 720 111 110 101 100 011 010 001 000 1 1024 2 1024 1022 1024 1023 1024 fs quantization error digital output ideal a/d conversion characteristic analog input voltage figure 13.4 definitions of a/d conversion accuracy fs digital output ideal a/d conversion characteristic nonlinearity error analog input voltage offset error actual a/d conversion characteristic full-scale error figure 13.5 definitions of a/d conversion accuracy
rev. 2.00, 09/04, page 394 of 720 13.7 usage notes 13.7.1 module standby mode setting operation of the a/d converter can be disabled or enabled using the module standby control register. the initial setting is for operation of th e a/d converter to be halted. register access is enabled by clearing module standby mode. for details, refer to section 24, power-down modes. 13.7.2 permissible si gnal source impedance this lsi's analog input is designed such that conv ersion accuracy is guarant eed for an input signal for which the signal source impedance is 1 k ? or less (20 mhz to 25 mhz) or 3 k ? or less (20mhz or less). this specification is provided to enable the a/d converter's sample-and-hold circuit input capacitance to be charged within the sampling time; if the sensor output impedance exceeds 1 k ? or 3 k ? , charging may be insufficient and it may not be possible to guarantee a/d conversion accuracy. however, for a/d conver sion in single mode with a large capacitance provided externally, the input load will essentially comprise only the internal input resistance of 10 k ? , and the signal source impedance is ignored. howe ver, as a low-pass filte r effect is obtained in this case, it may not be possible to follow an analog signal with a larg e differential coefficient (e.g., 5 mv/ s or greater) (see figure 13.6). when converting a high-speed analog signal or converting in scan mode, a low-impedance buffer should be inserted. 13.7.3 influences on absolute accuracy adding capacitance results in coupling with gnd, and therefor e noise in gnd may adversely affect absolute precision. be su re to make the connection to an electrically stable gnd such as avss. care is also required to insure that filter circuits do not interfe re in the accuracy by the digital signals on the printed circuit board (i.e, acting as antennas). 20 pf 10 k ? c in = 15 pf sensor output impedance of up to 3 k ? or up to 1 k ? this lsi low-pass filter c to 0.1 f sensor input a/d converter equivalent circuit figure 13.6 example of analog input circuit
rev. 2.00, 09/04, page 395 of 720 13.7.4 range of analog power supply and other pin settings if the conditions below are not met, the reliability of the device may be adversely affected. ? analog input voltage range the voltage applied to analog input pin ann during a/d conversion should be in the range avss van avcc. ? relationship between avcc, avss and vcc, vss set avss = vss for the relationship between avcc, avss and vcc, vss. if the a/d converter is not used, the avcc and avss pins must not be left open. 13.7.5 notes on board design in board design, digital circuitry and analog circuitry should be as mutually isolated as possible, and layout in which digital circuit signal lines and analog circuit signal lines cross or are in close proximity should be avoided as far as possible. failure to do so may result in incorrect operation of the analog circuitry due to in ductance, adversely affecting a/d co nversion values. also, digital circuitry must be isolated from the analog input signals (an0 to an15), and analog power supply (avcc) by the analog ground (avs s). also, the analog ground (avss) should be connected at one point to a stable ground (vss) on the board. 13.7.6 notes on no ise countermeasures a protection circuit should be connected in order to prevent damage due to abnormal voltage, such as an excessive surge at the an alog input pins (an0 to an15), between avcc and avss, as shown in figure 13.7. also, the bypass capacitors connected to avcc and the filter capacitor connected to an0 to an15 must be connected to avss. if a filter capacitor is connected, the input currents at the analog input pins (an0 to an15) are averaged, and so an error may arise. also, when a/d conversion is perfo rmed frequently, as in scan mode, if the current charged and discharged by the capacitance of the sample-and-hold circuit in the a/d converter excee ds the current input via the input impedance (r in ), an error will arise in the analog input pin voltage. careful consideration is therefore required when deciding circuit constants.
rev. 2.00, 09/04, page 396 of 720 avcc * 1 an0 to an15 avss r in * 2 100 ? 0.1 f 0.01 f 10 f notes: values are reference values. * 1 * 2 r in : input impedance figure 13.7 example of analog input protection circuit table 13.6 analog pin specifications item min max unit measurement conditions analog input capacitance ? 20 pf ? 3 k ? 20 mhz permissible signal source impedance ? 1 k ? 20 to 25mhz 20 pf an0 to an15 note: values are reference values. 10 k ? to a/d converter figure 13.8 analog input pin equivalent circuit
rev. 2.00, 09/04, page 397 of 720 section 14 compare match timer (cmt) this lsi has an on-chip compare match timer (c mt) comprising two 16-bit timer channels. the cmt has 16-bit counters and can gene rate interrupts at set intervals. 14.1 features the cmt has the following features: ? four types of counter input clock can be selected ? one of four internal clocks (p /8, p /32, p /128, p /512) can be selected independently for each channel. ? interrupt sources ? a compare match interrupt can be requested independently for each channel. ? module standby mode can be set figure 14.1 shows a block diagram of the cmt. control circuit clock selection module bus control circuit clock selection cmi0 cmi1 p /8 p /32 p /128 p /512 p /8 p /32 p /128 p /512 bus interface internal bus [legend] cmstr: compare match timer start register cmcsr: compare match timer control/status register cmcor: compare match timer constant register cmcnt: compare match timer counter cmi: compare match interrupt comparator cmstr cmt cmcsr0 cmcor0 comparator cmcnt0 cmcsr1 cmcor1 cmcnt1 figure 14.1 cmt block diagram
rev. 2.00, 09/04, page 398 of 720 14.2 register descriptions the cmt has the following registers for each ch annel. for details on register addresses and register states during each processing, refer to appendix a, internal i/o register. ? compare match timer start register (cmstr) ? compare match timer control/status register_0 (cmcsr_0) ? compare match timer counter_0 (cmcnt_0) ? compare match timer constant register_0 (cmcor_0) ? compare match timer control/status register_1 (cmcsr_1) ? compare match timer counter_1 (cmcnt_1) ? compare match timer constant register_1 (cmcor_1) 14.2.1 compare match tim er start register (cmstr) the compare match timer start register (cmstr) is a 16-bit register that selects whether to operate or halt the channel 0 and channel 1 counters (cmcnt). bit bit name initial value r/w description 15 to 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 1 str1 0 r/w count start 1 this bit selects whether to operate or halt compare match timer counter_1. 0: cmcnt_1 count operation halted 1: cmcnt_1 count operation 0 str0 0 r/w count start 0 this bit selects whether to operate or halt compare match timer counter_0. 0: cmcnt_0 count operation halted 1: cmcnt_0 count operation
rev. 2.00, 09/04, page 399 of 720 14.2.2 compare match timer control/status register_0 and 1(cmcsr_0, cmcsr_1) the compare match timer control/status register (c mcsr) is a 16-bit register that indicates the occurrence of compare matches, se ts the enable/disable status of interrupts, and establishes the clock used for incrementation. bit bit name initial value r/w description 15 to 8 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 7 cmf 0 r/(w) * compare match flag this flag indicates whether or not the cmcnt and cmcor values have matched. 0: cmcnt and cmcor values have not matched 1: cmcnt and cmcor values have matched [clearing conditions] ? write 0 to cmf after reading 1 from it ? when the dtc is activated by an cmi interrupt and data is transferred with the disel bit in dtmr of dtc = 0 6 cmie 0 r/w compare match interrupt enable this bit selects whether to enable or disable a compare match interrupt (cmi) when the cmcnt and cmcor values have matched (cmf = 1). 0: compare match interrupt (cmi) disabled 1: compare match interrupt (cmi) enabled 5 to 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 1 0 cks1 cks0 0 0 r/w r/w these bits select the clock input to cmcnt among the four internal clocks obtained by dividing the peripheral clock (p ). when the str bit of cmstr is set to 1, cmcnt begins incrementing wit h the clock selected by cks1 and cks0. 00: p /8 01: p /32 10: p /128 11: p /512 note: * only 0 can be written, for flag clearing.
rev. 2.00, 09/04, page 400 of 720 14.2.3 compare match timer counter_0 and 1 (cmcnt_0, cmcnt_1) the compare match timer counter (cmcnt) is a 16-bit register used as an up-counter for generating interrupt requests. the initial value is h'0000. 14.2.4 compare match timer constant register_0 and 1 (cmcor_0, cmcor_1) the compare match timer constant re gister (cmcor) is a 16-bit regi ster that sets the period for compare match with cmcnt. the initial value is h'ffff. 14.3 operation 14.3.1 cyclic count operation when an internal clock is selected with the ck s1, cks0 bits of the cmcsr register and the str bit of cmstr is set to 1, cmcnt begins incrementing with the selected clock. when the cmcnt counter value matches that of the comp are match constant register (cmcor), the cmcnt counter is cleared to h'0000 and the cmf flag of the cmcsr register is set to 1. if the cmie bit of the cmcsr register is set to 1 at this time, a compare match interrupt (cmi) is requested. the cmcnt counter begins counting up again from h'0000. figure 14.2 shows the compare match counter operation. cmcnt value cmcor h'0000 counter cleared by cmcor compare match time figure 14.2 counter operation
rev. 2.00, 09/04, page 401 of 720 14.3.2 cmcnt count timing one of four internal clocks (p /8, p /32, p /128, p /512) obtained by dividing the peripheral clock (p ) can be selected by the cks1 and cks0 bits of cmcsr. figure 14.3 shows the timing. p internal clock cmcnt input clock cmcnt n-1 n n+1 figure 14.3 count timing 14.4 interrupts 14.4.1 interrupt sources the cmt has a compare match inte rrupt for each channel, with independent vector addresses allocated to each of them. the corresponding interrupt request is output when interrupt request flag cmf is set to 1 and interrupt enable bit cmie has also been set to 1. when activating cpu interrupts by interrupt request, the priority between the channels can be changed by means of interrupt controller settings. see section 6, interrupt controller (intc), for details. the data transfer controller (dtc) can be activated by an interrupt request. in this case, the priority between channels is fixed. see section 8, data transfer controller (dtc), for details. 14.4.2 compare match flag set timing the cmf bit of the cmcsr register is set to 1 by the compare match signal generated when the cmcor register and the cmcnt counter match. the compare match signal is generated upon the final state of the match (timing at which the cmcnt counter matching count value is updated). consequently, after the cmcor register and the cmcnt counter match, a compare match signal will not be generated until a cmcnt counter input clock occurs. figure 14.4 shows the cmf bit set timing.
rev. 2.00, 09/04, page 402 of 720 p cmcnt input clock cmcnt cmcor n0 n compare match signal cmf cmi figure 14.4 cmf set timing 14.4.3 compare match flag clear timing the cmf bit of the cmcsr register is cleared by writing 0 to it after reading 1 or the clearing signal after the dtc transfer. figure 14.5 shows the timing when the cmf bit is cleared by the cpu. t1 t2 cmcsr write cycle p cmf figure 14.5 timing of cmf clear by the cpu
rev. 2.00, 09/04, page 403 of 720 14.5 usage notes 14.5.1 contention between cm cnt write and compare match if a compare match signal is generated during the t2 state of the cmcnt co unter write cycle, the cmcnt counter clear has priority, so the write to the cmcnt counter is not performed. figure 14.6 shows the timing. p t1 t2 address cmcnt internal write signal cmcnt n h' 0000 compare match signal cmcnt write cycle figure 14.6 cmcnt write an d compare match contention
rev. 2.00, 09/04, page 404 of 720 14.5.2 contention between cmcnt word write and incrementation if an increment occurs during the t2 state of th e cmcnt counter word wr ite cycle, the counter write has priority, so no increment occurs. figure 14.7 shows the timing. p t1 t2 address cmcnt internal write signal cmcnt nm cmcnt write data cmcnt input clock cmcnt write cycle figure 14.7 cmcnt word wr ite and increment contention
rev. 2.00, 09/04, page 405 of 720 14.5.3 contention between cmcnt byte write and incrementation if an increment occurs during the t2 state of th e cmcnt byte write cycle, the counter write has priority, so no increment of the write data resu lts on the side on which the write was performed. the byte data on the side on which writing was not performed is also not incremented, so the contents are those before the write. figure 14.8 shows the timing when an increment occurs during the t2 stat e of the cmcnth write cycle. p t1 t2 address cmcnth internal write signal cmcnth n m cmcntl xx cmcnth write data cmcnt input clock cmcnt write cycle figure 14.8 cmcnt byte wr ite and increment contention
rev. 2.00, 09/04, page 406 of 720
rev. 2.00, 09/04, page 407 of 720 section 15 controller area network 2 (hcan2) the controller area network 2 (hcan2) is a modu le for controlling a controller area network (can) for realtime communication in vehicular and industrial equipment systems, etc. for details on can specification, refer to bosch can specification version 2.0 1991, robert bosch gmbh. the block diagram of the hcan2 is shown in figure 15.1. 15.1 features ? can version: bosch 2.0b active compatible (conform to iso-11898 specification) communication systems: nrz (non-return to zero) system (with bit-stuffing function) broadcast communication system transmission path: bidirectiona l 2-wire serial communication communication speed: max. 1 mbps data length: 0 to 8 bytes ? number of channels: 1 channel ? data buffers: 32 buffers (two receive-onl y buffer and 30 buffers settable for transmission/reception) ? data transmission: can select from two methods mailbox (buffer) number order (high-to-low) message priority (identifier) reverse-order (high-to-low) ? data reception: two methods message identifier match (t ransmit/receive-setting buffers) reception with message identi fier masked (receive-only) ? interrupt sources: 14 (allocate to four independent interrupt vectors) error interrupt reset processing interrupt message reception interrupt message transmission interrupt ? hcan2 operating modes hardware reset software reset normal status (error-active, error-passive) bus off status hcan2 configuration mode hcan2 sleep mode hcan2 halt mode
rev. 2.00, 09/04, page 408 of 720 ? other feature the dtc can be activated by message r eceive mailbox (hcan2 mailbox 0 only) ? module standby mode can be set ? read section 15.8, usage notes. can interface transmit buffer receive buffer hrxd1 htxd1 rec irr mcr imr gsr bcr tec microprocessor interface (mpi) mailbox control mailboxes 0 to 31 (ram) ? message control ? message data ? lafm/tx-trigger time tcntr losr tcr icr tsr tcmr 16-bit timer txack txpr aback txcr rfpr rxpr umsr mbimr mailbox0 mailbox1 mailbox2 mailbox3 mailbox4 mailbox5 mailbox6 mailbox7 mailbox8 mailbox9 mailbox10 mailbox11 mailbox12 mailbox13 mailbox14 mailbox15 mailbox16 mailbox17 mailbox18 mailbox19 mailbox20 mailbox21 mailbox22 mailbox23 mailbox24 mailbox25 mailbox26 mailbox27 mailbox28 mailbox29 mailbox30 mailbox31 peripheral data bus peripheral address bus figure 15.1 hcan2 block diagram microprocessor interface (mpi): the mpi allows communicat ion between the cpu and hcan2?s registers/mailboxes to co ntrol the timer unit and memory in terface. it also contains the wakeup control logic that detects the can bus activities and notifies to the mpi and other parts of the hcan2 so that the hcan2 can au tomatically exit hcan2 sleep mode. mailbox (mb): the mailbox is essentially arrayed on th e ram as message buffers. there are 32 mailboxes, and each mailbox has the following information. ? can message control
rev. 2.00, 09/04, page 409 of 720 ? can message data (for can data frames) ? timestamp for receiving/transmitting messages ? sets the local acceptance filter ma sk (lafm) for recep tion or the trigger ti me for transmission. ? configures a 3 bit-wide mailbox, disables the au tomatic retransmission bit, and transmits the remote request bit, new message control bit, time trigger enable bit, and timer count values, etc. mailbox control: the mailbox control handles the following functions. for received messages, compares the ids, genera tes appropriate ram addr esses/data to store messages from the mailbox in the can interface, and sets or clear s the corresponding registers. to transmit messages, executes the internal arbitratio n, regardless of whether an event trigger or a time trigger, to select the correct priority message, loads the message from the mailbox into the can interface transmit buffer, and sets or clears the corresponding registers each time. arbitrates accesses between the host cpu and mailbox. includes registers such as txpr, txcr, txack, aback, rxpr, rfpr, mbimr, and umsr. timer: the timer is used as a supporting function fo r transmitting and receiving the messages that record hcan2-specific time frames and results. th e timer is a 16-bit free-running up counter controllable by the host cpu. two compare match registers generate the interrupt signal to clear the counter values and set the local offset regist ers. they also cancel the transmit wait messages. two input capture registers record the timestamps on the can message and globally synchronize the timer values in the can sy stem. a comparison match function of can-id on each mailbox allows transmission to be cancelled. the timer cl ock cycle permits a wide range of selection with the source clocks divided. the timer is comprised of registers such as tcntr, tcr, tsr, losr , icr0, icr1, tcmr0, and tcmr1. can interface: the can interface is a block that compli es with the requirements for the can bus data link controller. it meets all the dlc stan dards functions classified into an osi7 layer- referenced model. in order to comply with the standards given in the can bus, these functions are composed of the bit configuration register (bcr) including rec and tec and of registers and logics in various control modes. as a can data link controller, this block controls the functional classification of data reception and transmission.
rev. 2.00, 09/04, page 410 of 720 15.2 input/output pins table 15.1 shows the hcan2's pins. when using the functions of these external pins, the pin function controller (pfc) must also be set in line with the hcan2 settings. when using hcan2 pins, settings must be made in hcan2 configuration mode. table 15.1 hcan2 pins name abbreviation input/output function hcan2 transmit data pin htxd1 ou tput can bus transmission pin hcan2 receive data pin hrxd1 input can bus reception pin a bus driver is necessary for the interface be tween the pins and the can bus. a renesas ha13721 compatible model is recommended. 15.3 register descriptions the hcan2 has the following registers. for details on register addresses and register states during each process, refer to appendix a, internal i/o register. ? master control register (mcr) ? general status register (gsr) ? bit timing configuration register 1 (hcan2_bcr1*) ? bit timing configuration register 0 (hcan2_bcr0*) ? interrupt request register (irr) ? interrupt mask register (imr) ? error counter register (tec/rec) ? transmit wait registers (txpr1, txpr0) ? transmit wait cancel registers (txcr1, txcr0) ? transmit acknowledge regi sters (txack1, txack0) ? abort acknowledge registers (aback1, aback0) ? receive complete registers (rxpr1, rxpr0) ? remote request registers (rfpr1, rfpr0) ? mailbox interrupt mask registers (mbimr1, mbimr0) ? unread message status registers (umsr1, umsr0) ? mailboxes (16-bit 10 registers 32 sets) (mb0 to mb31) ? timer counter register (tcntr) ? timer control register (tcr) ? timer status re gister (tsr)
rev. 2.00, 09/04, page 411 of 720 ? local offset register (losr) ? input capture register 0 (icr0) ? input capture register 1 (hcan2_icr1*) ? timer compare match register 0 (tcmr0) ? timer compare match register 1 (tcmr1) note: * the module name hcan2 is omitted and they are abbreviated to bcr1, bcr0, and icr1 hereafter.
rev. 2.00, 09/04, page 412 of 720 master control register (mcr) general status register (gsr) bit timing configuration register 1 (bcr1) bit timing configuration register 0 (bcr0) interrupt register (irr) interrupt mask register (imr) mailbox 0 control (baseid, extid, rtr, ide, dlc, atx, dart, mbc) mailbox 0 timestamp 0 2 4 6 1 3 5 7 mailbox 0 lafm mailbox 1 control/timestamp/data/lafm mailbox 2 control/timestamp/data/lafm mailbox 3 control/timestamp/data/lafm transmit wait register (txpr1) transmit wait register (txpr0) transmit wait cancel register (txcr1) transmit wait cancel register (txcr0) transmit acknowledge register (txack1) transmit acknowledge register (txack0) abort acknowledge register (aback1) abort acknowledge register (aback0) receive wait register (rxpr1) receive wait register (rxpr0) remote request register (rfpr1) remote request register (rfpr0) mailbox interrupt mask register (mbimr1) mailbox interrupt mask register (mbimr0) unread message status register (umsr1) unread message status register (umsr0) timer counter register (tcntr) timer control register (tcr) timer status register (tsr) local offset register (losr) transmit error counter (tec) receive error counter (rec) h'000 h'002 h'004 h'006 h'008 h'00a h'00c h'100 h'106 h'108 h'10a h'10c h'10e h'110 h'120 h'140 h'160 h'2e0 h'2f3 h'300 h'4a0 h'4c0 h'4e0 h'4f3 h'020 h'022 bit 15 bit 0 h'028 h'02a h'030 h'032 h'038 h'03a h'040 h'042 h'048 h'04a h'050 h'052 h'058 h'05a h'080 h'082 h'084 h'088 h'08c h'08e h'090 h'092 h'094 input capture register 0 (icr0) input capture register 1 (icr1) timer compare match register 0 (tcmr0) timer compare match register 1 (tcmr1) mailbox 0 data (8 bytes) mailbox 15 control/timestamp/data/lafm mailbox 16 control/timestamp/data/lafm mailbox 29 control/timestamp/data/lafm mailbox 30 control/timestamp/data/lafm mailbox 31 control/timestamp/data/lafm figure 15.2 register configuration
rev. 2.00, 09/04, page 413 of 720 15.3.1 master control register (mcr) mcr is a 16-bit register that controls the hcan2 operation. bit bit name initial value r/w description 15 tst7 0 r/w test mode enables/disables the test modes settable by tst[6:0]. when this bit is set, the following tst[6:0] become effective. 0: hcan2 is in normal mode 1: hcan2 is in test mode 14 tst6 0 r/w write can error counters enables the tec (transmit error counter) and rec (receive error counter) to be writable. the same value can only be written into the tec/rec at the same time. the maximum value that can be written into the tec/rec is d'255 (h'ff). this means that the hcan2 cannot be forced into the bus off state. before writing into the tec/rec, hcan2 needs to be put into halt mode, and when writing into the tec/rec, the tst7 (mcr15) needs to be ?1?. only the same value can be set between tec/rec, and the value writt en into tec is used to write rec. 0: tec/rec is not writable but read-only 1: tec/rec is writable with the same value at the same time 13 tst5 0 r/w force to error passive forces hcan2 to become error passive. when this bit is set, hcan2 behaves as an error passive node, regardless of the error counters. 0: state of hcan2 depends on the error counters 1: hcan2 behaves as an error passive node regardless of the error counters
rev. 2.00, 09/04, page 414 of 720 bit bit name initial value r/w description 12 tst4 0 r/w auto acknowledge mode allows hcan2 to generate its own acknowledge bit in order to enable self test. in order to achieve the self test mode, there are two type settings for this. one is to set (tst0 = 1 & tst1 = 1 & tst2 = 1), so that the tx value can be internally provided to the rx. the other way is to set (tst0 = 0 & tst1 = 0 & tst2 = 0) and connect the tx and rx onto the can bus so that the data can be transmitted via the can bus. 0: hcan2 does not generate its own acknowledge bit 1: hcan2 generates its own acknowledge bit 11 tst3 0 r/w disable error counters enables/disables the error counters (tec/rec) to be functional. when this bit is enabled, the error counters (tec/rec) remain unchanged and holds the current value. when this bit is disabled, the error counters (tec/rec) function according to the can specification. 0: error counters (tec/rec) function according to the can specification 1: error counters (tec/rec) remain unchanged and holds the current value 10 tst2 0 r/w disable rx input controls the rx to be supplied into the can interface block. when this bit is enabled, the rx pin value is supplied into the can interface block. when this bit is disabled, the rx value for the can block always remains recessive or the tx value internally connected if tst0 = 1. 0: external rx pin is supplied for the can interface block 1: [tst0 = 0] rx always re main recessive for the can interface block [tst0 = 1] tx is internally supplied for the can interface block
rev. 2.00, 09/04, page 415 of 720 bit bit name initial value r/w description 9 tst1 0 r/w disable tx output controls the tx output pi n to output transmit data or recessive bits. if this bit is enabled, the internal transmit output value appears on the tx pin. if this bit is disabled, the tx output pin always remains recessive. 0: external tx pin is supplied for the can interface block 1: [tst0 = 0] tx always recessive on the tx pin [tst0 = 1] tx is internally looped backed to the internal rx 8 tst0 0 r/w enable internal loop enables/disables the internal tx looped back to the internal rx. 0: rx is fed from the rx pin 1: rx is fed back from the internal tx signal 7 mcr7 0 r/w hcan2 sleep mode release when this bit is set to 1, the hcan2 automatically exits hcan2 sleep mode on detection of can bus operation. 6 ? 0 r reserved this bit is always read as 0. the write value should always be 0.
rev. 2.00, 09/04, page 416 of 720 bit bit name initial value r/w description 5 mcr5 0 r/w hcan2 sleep mode this bit enables or disables mode shift to sleep mode. when this bit is set to 1, mode shift to sleep mode is enabled. the hcan2 enters sleep mode after current bus access finished. the hcan2 ignores the can bus operation until sleep mode is finished. the values of two error counters (rec and tec) are not changed in sleep mode and the subsequent m ode. there are two methods to clear sleep mode: ? clear this bit to 0 ? when mcr7 is enabled, detects the dominant bit on the can bus to clear sleep mode, hcan2 makes synchronization with the can bus by checking 11 recessive bits before joining in the can bus activity. it means that the hcan2 cannot receive the first message when the above second method is used. also the can transceiver has the same feature. therefore, the software should be designed in this manner. note: this mode is as same as halt mode or stopping the clock. it means that an interrupt is generated by irr0 when mode shift to sleep mode is performed. in sleep mode, only the mpi block (mcr, gsr, irr and imr) can be accessed. however, irr1 cannot be cleared in sleep mode, since irr1 is ored with the rxpr signal which cannot be cleared in sleep mode. it is recommended that first set halt mode, clear the source register for irr setting, clear halt mode, and then make transition to sleep mode. 0: hcan2 sleep mode is cleared 1: transition to hcan2 sleep mode is enabled note: the mailboxes should not be accessed in hcan2 sleep mode. if the mailboxes are accessed in hcan2 sleep mode, cpu may stop. however, the cpu does not stop when registers that are not relevant to mailboxes are accessed in sleep mode or mailboxes are accessed in other modes. 4, 3 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
rev. 2.00, 09/04, page 417 of 720 bit bit name initial value r/w description 2 mcr2 0 r/w message transmission method 0: transmission order determined by message identifier priority 1: transmission order determined by mailbox number priority (txpr30 > txpr1) 1 mcr1 0 r/w hcan2 halt mode when this bit is set to 1, the hcan2 completes current operation and then disconnects the can bus. the hcan2 remains in halt mode until this bit is cleared. during halt mode, the can interface does not join in the can bus activity or neither store nor transmit messages. the contents of all registers and mailboxes remain. if the hcan2 is in transmission or reception, the hcan2 completes the operation and ent ers halt mode. if the can bus is in the idle state or intermission state, hcan2 enters halt mode immediately. irr0 and gst4 notify that the hcan has entered halt mode. if a halt request is made during bus off, hcan2 remains bus off even after 128 11 recessive bits. to exit this state, halt mode should be cleared by the software. since the hcan2 does not join in the bus activity in halt mode, the hcan2 configurati on can be changed. to join in the can bus activity, this bit need to be cleared to 0. after this bit is cleared to 0, the can interface waits until it detects 11 recessive bits, and then joins in the can bus activity. 0: normal operating mode 1: transition to halt mode is requested
rev. 2.00, 09/04, page 418 of 720 bit bit name initial value r/w description 0 mcr0 1 r/w reset request when this bit is set to 1, the hcan2 transits to reset mode. for details, refer to section 15.4.1, hardware and software resets. [setting conditions] ? power-on reset ? manual reset ? hardware standby ? software standby ? 1-write (software reset) [clearing condition] ? when 0 is written to this bit while the gsr3 bit in gsr is 1 note: before writing 0 to this bit, confirm that the gsr3 bit is 1. 15.3.2 general status register (gsr) gsr is a 16-bit register that indicates the hcan2 status. bit bit name initial value r/w description 15 to 6 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 5 gsr5 0 r error passive status bit indicates whether the hcan2 is in the error passive state. 0: hcan2 is not in the error passive state 1: hcan2 is in the error passive state [clear condition] ? hcan2 is error active state [setting condition] ? when tec 128 or rec 128
rev. 2.00, 09/04, page 419 of 720 bit bit name initial value r/w description 4 gsr4 0 r halt/sleep status bit indicates whether the hcan2 interface is in halt mode or sleep mode. 0: not in halt or sleep mode 1: in halt (mcr1 = 1) or sleep (mcr5 = 1) mode [setting condition] ? mcr1 or mcr5 is set, and can bus is suspended or in the idle state. 3 gsr3 1 r reset status bit indicates whether the hcan2 module is in the normal operating state or the reset state. [setting condition] ? when entering configuratio n mode after the hcan2 internal reset has finished [clearing condition] ? when entering normal operation mode after the mcr0 bit in mcr is cleared to 0 (note that there is a delay between clearing of the mcr0 bit and the gsr3 bit.) 2 gsr2 1 r message transmission status flag flag that indicates whether the module is currently in the message transmission period. [setting condition] ? no message transmission requests [clearing condition] ? transmission is in progress 1 gsr1 0 r transmit/receive warning flag [clearing conditions] ? when tec < 96 and rec < 96 ? when tec 256 [setting condition] ? when 256 > tec 96 or 256 > rec 96
rev. 2.00, 09/04, page 420 of 720 bit bit name initial value r/w description 0 gsr0 0 r bus off flag this bit cannot be modified. [setting condition] ? when tec 256 (bus off state) [clearing condition] ? recovery from bus off state 15.3.3 bit timing configuration register 1 (hcan2_bcr1) bcr is a 32-bit register that is used to set the hcan2 bit timing and baud rate prescaler. it is composed of two 16-bit registers, hc an2_bcr1 and hcan2_bcr0. (hcan2_bcr1 is abbreviated to bcr1 in this section.) bit bit name initial value r/w description 15 14 13 12 tseg1_3 tseg1_2 tseg1_1 tseg1_0 0 0 0 0 r/w r/w r/w r/w time segment 1 (tseg1) set the tseg1 (prseg + phseg1) size as a value from 4 to 16 time quanta. 0000: setting prohibited 0001: setting prohibited 0010: setting prohibited 0011: 4 time quanta 0100: 5 time quanta 0101: 6 time quanta 0110: 7 time quanta 0111: 8 time quanta 1000: 9 time quanta 1001: 10 time quanta 1010: 11 time quanta 1011: 12 time quanta 1100: 13 time quanta 1101: 14 time quanta 1110: 15 time quanta 1111: 16 time quanta
rev. 2.00, 09/04, page 421 of 720 bit bit name initial value r/w description 11 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 10 9 8 tseg2_2 tseg2_1 tseg2_0 0 0 0 r/w r/w r/w time segment 2 (tseg2) set the tseg2 (phseg2) size as a value from 2 to 8 time quanta. 000: setting prohibited 001: 2 time quanta 010: 3 time quanta 011: 4 time quanta 100: 5 time quanta 101: 6 time quanta 110: 7 time quanta 111: 8 time quanta 7, 6 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 5 4 sjw1 sjw0 0 0 r/w r/w re-synchronization jump width (sjw) set the maximum bit synchronization width. 00: 1 time quantum 01: 2 time quanta 10: 3 time quanta 11: 4 time quanta 3 to 1 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 0 bsp 0 r/w bit sample point (bsp) sets the point at which data is sampled. 0: bit sampling at one point (end of tseg1) 1: bit sampling at three point s (end of tseg1, and 1 time quantum before and after) note: when this bit is set to 1, the baud rate prescaler value which is set in brp7 to brp0 bits in bcr0 should be set below 5 system clocks.
rev. 2.00, 09/04, page 422 of 720 15.3.4 bit timing configuration register 0 (hcan2_bcr0) bcr is a 32-bit register that is used to set the hcan2 bit timing and baud rate prescaler. it is composed of two 16-bit registers, hc an2_bcr1 and hcan2_bcr0. (hcan2_bcr0 is abbreviated to bcr0 in this section.) bit bit name initial value r/w description 15 to 8 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 7 6 5 4 3 2 1 0 brp7 brp6 brp5 brp4 brp3 brp2 brp1 brp0 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w baud rate prescaler (brp) set the time quanta length. the length should be set (brp value + 1) times of the system clocks for hcan2 ( /2). 00000000: 1 system clock 00000001: 2 system clocks 00000010: 3 system clocks : 11111110: 255 system clocks 11111111: 256 system clocks 15.3.5 interrupt re quest register (irr) irr is a 16-bit interrupt status flag register. bit bit name initial value r/w description 15 irr15 0 r/w timer compare match interrupt flag 1 indicates that a compare match occurred in tcmr1. 0: timer compare match has not occurred in tcmr1 1: timer compare match has occurred in tcmr1 [clearing condition] ? writing 1 [setting condition] ? tcmr1 = tcntr note: this bit is not set when tcmr1 = h 0000.
rev. 2.00, 09/04, page 423 of 720 bit bit name initial value r/w description 14 irr14 0 r/w timer compare match interrupt flag 0 indicates that a compare match occurred in tcmr0. 0: timer compare match has not occurred in tcmr0 1: timer compare match has occurred in tcmr0 [clearing condition] ? writing 1 [setting condition] ? tcmr0 = tcntr note: this bit is not set when tcmr0 = h'0000. 13 irr13 0 r/w timer overflow interrupt flag indicates that the timer has overflowed. 0: timer has not overflowed 1: timer has overflowed [clearing condition] ? writing 1 [setting condition] ? timer has overflowed and the value of tcntr changes from h'ffff to h'0000. note: this bit is set even when tcmr0 is enabled to clear the timer value and its value is set to h'ffff. 12 irr12 0 r/w bus operation interrupt flag status flag indicating detection of a dominant bit due to bus operation when the hcan2 module is in hcan2 sleep mode. 0: bus idle state (during hcan2 sleep mode) 1: can bus operation (during hcan2 sleep mode) [clearing condition] ? writing 1 [setting condition] ? when the bus operation (dom inant bit) is detected during hcan2 sleep mode 11, 10 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
rev. 2.00, 09/04, page 424 of 720 bit bit name initial value r/w description 9 irr9 0 r unread message interrupt flag status flag indicating that a message has been received but the existing message in that mailbox has not yet been read due to the corresponding rxpr or rfpr set to 1. the received message is either ignored (overrun) or overwritten depending on the nmc (new message control) bit. note: to clear this bit, clear the umsr bit by writing 1 to corresponding umsr bit. writing 0 has no effect. 0: no message overrun or overwritten 1: receive message overrun or overwritten [clearing condition] ? all the umsr bits are cleared [setting conditions] ? message is received while the corresponding rxpr or rfpr = 1 and mbimr = 0 ? any umsr bit is set 8 irr8 0 r/w mailbox empty interrupt flag this bit is set when at least one txpr bit is cleared. it is a status flag indicating that the mailbox is now ready to accept a new transmit message. in effect, this bit is set when any bit in txack or aback is set, therefore, this bit is automatically cleared when all the txack and aback bits are cleared. 0: transmission or transmission abort of a message is not yet carried out. 1: message has been transmitted or aborted, and new message can be stored [clearing condition] ? when all the txack and aback bits are cleared [setting condition] ? when one of the txpr (transmit wait) bits is cleared by completion of transmission or completion of transmission abort, i.e., when a txack or aback bit is set (if mbimr = 0). note: this bit does not indicate that all txpr bits are reset.
rev. 2.00, 09/04, page 425 of 720 bit bit name initial value r/w description 7 irr7 0 r/w overload frame interrupt flag [setting condition] ? overload frame transmitted [clearing condition] ? writing 1 6 irr6 0 r/w bus off/bus off recovery interrupt flag status flag indicating that t he hcan2 has entered the bus off state or the hcan2 has en tered from the bus off state to the error active state. [setting conditions] ? when tec 256 ? when 11 recessive bits are received 128 times (rec 128) in the bus off state [clearing condition] ? writing 1 5 irr5 0 r/w error passive interrupt flag status flag indicating the erro r passive state caused by the transmit/receive error counter. [setting condition] ? when tec 128 or rec 128 [clearing condition] ? writing 1 4 irr4 0 r/w receive error warning interrupt flag status flag indicating the erro r warning state caused by the receive error counter. [setting condition] ? when rec 96 [clearing condition] ? writing 1 3 irr3 0 r/w transmit error warning interrupt flag status flag indicating the erro r warning state caused by the transmit error counter. [setting condition] ? when tec 96 [clearing condition] ? writing 1
rev. 2.00, 09/04, page 426 of 720 bit bit name initial value r/w description 2 irr2 0 r remote frame request interrupt flag status flag indicating that a remote frame has been received in a mailbox. [setting condition] ? when remote frame reception is completed and corresponding mbimr = 0 [clearing condition] ? all bits in the remote request wait register (rfpr) are cleared 1 irr1 0 r receive message interrupt flag status flag indicating that a message has been received normally in a mailbox. [setting condition] ? when data frame reception is completed and corresponding mbimr = 0 [clearing condition] ? all bits in the receive complete register (rxpr) are cleared 0 irr0 1 r/w reset/halt/sleep interrupt flag status flag indicating that the hcan2 has been reset or halted and the hcan2 is now in configuration mode. an interrupt signal will be generated if the mcr0 (software reset), mcr1 (halt), or mcr5 (sleep) bit in mcr is set to 1. gsr needs to be read after this bit is set. 1: transition to software reset mode, halt mode, or sleep mode [clearing condition] ? writing 1 [setting condition] ? when processing is completed after software reset mode (mcr0), halt mode (mcr1), or sleep mode (mcr5) is requested
rev. 2.00, 09/04, page 427 of 720 15.3.6 interrupt ma sk register (imr) imr is a 16-bit register that enables interrupt requests caused by irr interrupt flags. bit bit name initial value r/w description 15 imr15 1 r/w timer compare match interrupt 1 mask when this bit is cleared to 0, ovr1 (interrupt request by irr15) is enabled. when set to 1, ovr1 is masked. 14 imr14 1 r/w timer compare match interrupt 0 mask when this bit is cleared to 0, ovr1 (interrupt request by irr14) is enabled. when set to 1, ovr1 is masked. 13 imr13 1 r/w timer overflow interrupt mask when this bit is cleared to 0, ovr1 (interrupt request by irr13) is enabled. when set to 1, ovr1 is masked. 12 imr12 1 r/w bus operation interrupt mask when this bit is cleared to 0, ovr1 (interrupt request by irr12) is enabled. when set to 1, ovr1 is masked. 11, 10 ? all 1 r reserved these bits are always read as 1. the write value should always be 1. 9 imr9 1 r/w unread interrupt mask when this bit is cleared to 0, ovr1 (interrupt request by irr9) is enabled. when set to 1, ovr1 is masked. 8 imr8 1 r/w mailbox empty interrupt mask when this bit is cleared to 0, sle1 (interrupt request by irr8) is enabled. when set to 1, sle1 is masked. 7 imr7 1 r/w overload frame interrupt mask when this bit is cleared to 0, ovr1 (interrupt request by irr7) is enabled. when set to 1, ovr1 is masked. 6 imr6 1 r/w bus off/bus off recovery interrupt mask when this bit is cleared to 0, ers1 (interrupt request by irr6) is enabled. when set to 1, ers1 is masked. 5 imr5 1 r/w error passive interrupt mask when this bit is cleared to 0, ers1 (interrupt request by irr5) is enabled. when set to 1, ers1 is masked. 4 imr4 1 r/w receive error warning interrupt mask when this bit is cleared to 0, ers1 (interrupt request by irr4) is enabled. when set to 1, ers1 is masked.
rev. 2.00, 09/04, page 428 of 720 bit bit name initial value r/w description 3 imr3 1 r/w transmit error warning interrupt mask when this bit is cleared to 0, ers1 (interrupt request by irr3) is enabled. when set to 1, ers1 is masked. 2 imr2 1 r/w remote frame request interrupt mask when this bit is cleared to 0, rm1 (interrupt request by irr2) is enabled. when set to 1, rm1 is masked. 1 imr1 1 r/w receive message interrupt mask when this bit is cleared to 0, rm1 (interrupt request by irr1) is enabled. when set to 1, rm1 is masked. 0 imr0 1 r/w reset/halt/sleep interrupt mask when this bit is cleared to 0, ovr1 (interrupt request by irr0) is enabled. when set to 1, ovr1 is masked.
rev. 2.00, 09/04, page 429 of 720 15.3.7 error counter register (tec/rec) the error counter register is a 16-bit read-only register composed of the transmit error counter (tec) and receive error counter (rec). tec is an 8-bit register that functions as a co unter indicating the number of transmit message errors on the can bus. the count valu e is stipulated in the can protocol. rec is an 8-bit register that functions as a counter indicating the number of receive message errors on the can bus. the count valu e is stipulated in the can protocol. bit bit name initial value r/w description 15 14 13 12 11 10 9 8 tec7 tec6 tec5 tec4 tec3 tec2 tec1 tec0 0 0 0 0 0 0 0 0 r r r r r r r r transmit error counter this register can be cleared by a reset request (mcr0) or the bus off state. 7 6 5 4 3 2 1 0 rec7 rec6 rec5 rec4 rec3 rec2 rec1 rec0 0 0 0 0 0 0 0 0 r r r r r r r r receive error counter this register can be cleared by a reset request (mcr0) or the bus off state.
rev. 2.00, 09/04, page 430 of 720 15.3.8 transmit wait registers (txpr1, txpr0) txpr1 and txpr0 are 16-bit registers that are used to set a transmit wait (can bus arbitration wait) for transmit messages stored in mailboxes. ? txpr1 bit bit name initial value r/w description 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 txpr31 txpr30 txpr29 txpr28 txpr27 txpr26 txpr25 txpr24 txpr23 txpr22 txpr21 txpr20 txpr19 txpr18 txpr17 txpr16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w set a transmit wait (can bus arbitration wait) for the corresponding mailboxes from 16 to 31. when txprn (n = 16 to 31) is set to 1, the message in mailbox n enters transmit wait state. 0: transmit message in corresponding mailbox is in idle state 1: transmit message in corresponding mailbox is waiting for transmit [clearing conditions] ? completion of message transmission ? completion of transmission abort txpr flags can be cleared only when the messages are transmitted normally. notes: 1. 1 can be written only when the mailbox is configured as a transmit mailbox. 2. restrictions apply to the use of the mailbox 31 for transmission. carefully read section 15.8, usage notes.
rev. 2.00, 09/04, page 431 of 720 ? txpr0 bit bit name initial value r/w description 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 txpr15 txpr14 txpr13 txpr12 txpr11 txpr10 txpr9 txpr8 txpr7 txpr6 txpr5 txpr4 txpr3 txpr2 txpr1 ? 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r set a transmit wait (can bus arbitration wait) for the corresponding mailboxes from 1 to 15. when txprn (n = 1 to 15) is set to 1, the message in mailbox n enters transmit wait state. 0: transmit message in corresponding mailbox is in idle state 1: transmit message in corresponding mailbox is waiting for transmit [clearing conditions] ? completion of message transmission ? completion of transmission abort bit 0 is reserved. this bit is always read as 0. the write value should always be 0. txpr flags can be cleared only when the messages are transmitted normally. note: 1 can be written only when the mailbox is configured as a transmit mailbox.
rev. 2.00, 09/04, page 432 of 720 15.3.9 transmit wait cancel registers (txcr1, txcr0) txcr1 and txcr0 are 16-bit registers that cont rol cancellation of transmit wait messages in mailboxes. ? txcr1 bit bit name initial value r/w description 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 txcr31 txcr30 txcr29 txcr28 txcr27 txcr26 txcr25 txcr24 txcr23 txcr22 txcr21 txcr20 txcr19 txcr18 txcr17 txcr16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w cancel the transmit wait message in the corresponding mailboxes from 16 to 31. when txcrn (n = 16 to 31) is set to 1, the transmit wait message in mailbox n is canceled. [clearing condition] ? completion of txpr clearing (when transmit message is canceled normally), or normal end process is carried out (when transmit message is being transmitted, thereby unable to be canceled) to clear the corresponding bit in txpr, 1 must be written to the corresponding bit txcr. when cancellation has succeeded, the hcan2 clears the corresponding txpr/txcr bits, and sets the corresponding aback bit. however, once a mailbox has started transmission, it cannot be canceled by this bit. notes: 1. 1 can be written only when the mailbox is configured as a transmit mailbox. 2. restrictions apply to the use of the mailbox 31 for transmission. carefully read section 15.8, usage notes.
rev. 2.00, 09/04, page 433 of 720 ? txcr0 bit bit name initial value r/w description 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 txcr15 txcr14 txcr13 txcr12 txcr11 txcr10 txcr9 txcr8 txcr7 txcr6 txcr5 txcr4 txcr3 txcr2 txcr1 ? 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r cancel the transmit wait message in the corresponding mailboxes from 1 to 15. when txcrn (n = 1 to 15) is set to 1, the transmit wait message in mailbox n is canceled. [clearing condition] ? completion of txpr clearing (when transmit message is canceled normally), or normal end process is carried out (when transmit message is being transmitted, thereby unable to be canceled) bit 0 is reserved. this bit is always read as 0. the write value should always be 0. to clear the corresponding bit in txpr, 1 must be written to the corresponding bit txcr. when cancellation has succeeded, the hcan2 clears the corresponding txpr/txcr bits, and sets the corresponding aback bit. however, once a mailbox has started transmission, it cannot be canceled by this bit. note: 1 can be written only when the mailbox is configured as a transmit mailbox.
rev. 2.00, 09/04, page 434 of 720 15.3.10 transmit acknowledge registers (txack1, txack0) txack1 and txack0 are 16-bit registers cont aining status flags that indicate normal transmission of mailbox transmit messages. ? txack1 bit bit name initial value r/w description 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 txack31 txack30 txack29 txack28 txack27 txack26 txack25 txack24 txack23 txack22 txack21 txack20 txack19 txack18 txack17 txack16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w status flags that indicate error-free transmission of the transmit message in the corresponding mailboxes from 16 to 31. when the message in mailbox n (n = 16 to 31) has been transmitted error- free, txackn is set to 1. [setting condition] ? completion of message transmission for corresponding mailbox [clearing condition] ? writing 1 notes: 1. writing operation by the cpu is valid only for clearing condition (writing 1) of set status. 2. restrictions apply to the use of the mailbox 31 for transmission. carefully read section 15.8, usage notes.
rev. 2.00, 09/04, page 435 of 720 ? txack0 bit bit name initial value r/w description 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 txack15 txack14 txack13 txack12 txack11 txack10 txack9 txack8 txack7 txack6 txack5 txack4 txack3 txack2 txack1 ? 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r status flags that indicate error-free transmission of the transmit message in the corresponding mailboxes from 1 to 15. when the message in mailbox n (n = 1 to 15) has been transmitted error- free, txackn is set to 1. [setting condition] ? completion of message transmission for corresponding mailbox [clearing condition] ? writing 1 bit 0 is reserved. this bit is always read as 0. the write value should always be 0. note: writing operation by the cpu is valid only for clearing condition (writing 1) of set status.
rev. 2.00, 09/04, page 436 of 720 15.3.11 abort acknowledge registers (aback1, aback0) aback1 and aback0 are 16-bit registers cont aining status flags that indicate normal cancellation (abort) of mailbox transmit messages. ? aback1 bit bit name initial value r/w description 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 aback31 aback30 aback29 aback28 aback27 aback26 aback25 aback24 aback23 aback22 aback21 aback20 aback19 aback18 aback17 aback16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w status flags that indicate error-free cancellation of the transmit message in the corresponding mailboxes from 16 to 31. when the message in mailbox n (n = 16 to 31) has been canceled error- free, abackn is set to 1. [setting condition] ? completion of transmit message abort for corresponding mailbox [clearing condition] ? writing 1 notes: 1. writing operation by the cpu is valid only for clearing condition (writing 1) of set status. 2. restrictions apply to the use of the mailbox 31 for transmission. carefully read section 15.8, usage notes.
rev. 2.00, 09/04, page 437 of 720 ? aback0 bit bit name initial value r/w description 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 aback15 aback14 aback13 aback12 aback11 aback10 aback9 aback8 aback7 aback6 aback5 aback4 aback3 aback2 aback1 ? 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r status flags that indicate error-free cancellation of the transmit message in the corresponding mailboxes from 1 to 15. when the message in mailbox n (n = 1 to 15) has been canceled error-free, abackn is set to 1. [setting condition] ? completion of transmit message abort for corresponding mailbox [clearing condition] ? writing 1 bit 0 is reserved. this bit is always read as 0. the write value should always be 0. note: writing operation by the cpu is valid only for clearing condition (writing 1) of set status.
rev. 2.00, 09/04, page 438 of 720 15.3.12 receive complete registers (rxp r1, rxpr0) rxpr1 and rxpr0 are 16-bit registers containing stat us flags that indicate normal reception of data frames in mailboxes. ? rxpr1 bit bit name initial value r/w description 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 rxpr31 rxpr30 rxpr29 rxpr28 rxpr27 rxpr26 rxpr25 rxpr24 rxpr23 rxpr22 rxpr21 rxpr20 rxpr19 rxpr18 rxpr17 rxpr16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w when the data frame in mailbox n (n = 16 to 31) has been received error-free, rxprn is set to 1. [setting condition] ? completion of data frame or remote frame reception in corresponding mailbox [clearing condition] ? writing 1 note: writing operation by the cpu is valid only for clearing condition (writing 1) of set status.
rev. 2.00, 09/04, page 439 of 720 ? rxpr0 bit bit name initial value r/w description 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 rxpr15 rxpr14 rxpr13 rxpr12 rxpr11 rxpr10 rxpr9 rxpr8 rxpr7 rxpr6 rxpr5 rxpr4 rxpr3 rxpr2 rxpr1 rxpr0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w when the data frame in mailbox n (n = 0 to 15) has been received error-free, rxprn is set to 1. [setting condition] ? completion of data frame or remote frame reception in corresponding mailbox [clearing condition] ? writing 1 note: writing operation by the cpu is valid only for clearing condition (writing 1) of set status.
rev. 2.00, 09/04, page 440 of 720 15.3.13 remote request registers (rfpr1, rfpr0) rfpr1 and rfpr0 are 16-bit register s containing status flags that indicate normal reception of remote frames in mailboxes. ? rfpr1 bit bit name initial value r/w description 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 rfpr31 rfpr30 rfpr29 rfpr28 rfpr27 rfpr26 rfpr25 rfpr24 rfpr23 rfpr22 rfpr21 rfpr20 rfpr19 rfpr18 rfpr17 rfpr16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w when the remote frame in mailbox n (n = 16 to 31) has been received error-free, rfprn (n = 16 to 31) is set to 1. [setting condition] ? completion of remote frame reception in corresponding mailbox [clearing condition] ? writing 1 note: writing operation by the cpu is valid only for clearing condition (writing 1) of set status.
rev. 2.00, 09/04, page 441 of 720 ? rfpr0 bit bit name initial value r/w description 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 rfpr15 rfpr14 rfpr13 rfpr12 rfpr11 rfpr10 rfpr9 rfpr8 rfpr7 rfpr6 rfpr5 rfpr4 rfpr3 rfpr2 rfpr1 rfpr0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w when the remote frame in mailbox n (n = 0 to 15) has been received error-free, rfprn (n = 0 to 15) is set to 1. [setting condition] ? completion of remote frame reception in corresponding mailbox [clearing condition] ? writing 1 note: writing operation by the cpu is valid only for clearing condition (writing 1) of set status.
rev. 2.00, 09/04, page 442 of 720 15.3.14 mailbox interrupt mask registers (mbimr1, mbimr0) mbimr1 and mbimr0 are 16-bit registers that enable individual mailbox interrupt requests. ? mbimr1 bit bit name initial value r/w description 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 mbimr31 mbimr30 mbimr29 mbimr28 mbimr27 mbimr26 mbimr25 mbimr24 mbimr23 mbimr22 mbimr21 mbimr20 mbimr19 mbimr18 mbimr17 mbimr16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w when mbimrn (n = 16 to 31) is cleared to 0, the interrupt request in mailbox n is enabled. when set to 1, the interrupt request is masked. the interrupt source in a transmit mailbox is txprn (n = 16 to 31) clearing caused by transmission end or transmission abort. the interrupt source in a receive mailbox is rxprn (n = 16 to 31) setting caused by reception end. 0: interrupt request in corresponding mailbox is enabled 1: interrupt request in corresponding mailbox is disabled
rev. 2.00, 09/04, page 443 of 720 ? mbimr0 bit bit name initial value r/w description 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 mbimr15 mbimr14 mbimr13 mbimr12 mbimr11 mbimr10 mbimr9 mbimr8 mbimr7 mbimr6 mbimr5 mbimr4 mbimr3 mbimr2 mbimr1 mbimr0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w when mbimrn (n = 0 to 15) is cleared to 0, the interrupt request in mailbox n is enabled. when set to 1, the interrupt request is masked. the interrupt source in a transmit mailbox is txprn (n = 1 to 15) clearing caused by transmission end or transmission abort. the interrupt source in a receive mailbox is rxprn (n = 0 to 15) setting caused by reception end. 0: interrupt request in corresponding mailbox is enabled 1: interrupt request in corresponding mailbox is disabled
rev. 2.00, 09/04, page 444 of 720 15.3.15 unread message status registers (umsr1, umsr0) umsr1 and umsr0 are 16-bit status registers th at indicate an unread receive message in a mailbox is overwritten by a new message. when ov erwritten by a new message, data in the unread receive message is lost. ? umsr1 bit bit name initial value r/w description 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 umsr31 umsr30 umsr29 umsr28 umsr27 umsr26 umsr25 umsr24 umsr23 umsr22 umsr21 umsr20 umsr19 umsr18 umsr17 umsr16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w unread receive message is overwritten by a new message [setting condition] ? when a new message is received before rxpr is cleared [clearing condition] ? writing 1 note: writing operation by the cpu is valid only for clearing condition (writing 1) of set status.
rev. 2.00, 09/04, page 445 of 720 ? umsr0 bit bit name initial value r/w description 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 umsr15 umsr14 umsr13 umsr12 umsr11 umsr10 umsr9 umsr8 umsr7 umsr6 umsr5 umsr4 umsr3 umsr2 umsr1 umsr0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w unread receive message is overwritten by a new message [setting condition] ? when a new message is received before rxpr is cleared [clearing condition] ? writing 1 note: writing operation by the cpu is valid only for clearing condition (writing 1) of set status. 15.3.16 mailboxes (mb0 to mb31) mailboxes play a role as message buffers to transmit/receive can fram es. each mailbox is comprised of four identical stor age fields (message control, message data, timestamp, and local acceptance filter mask (lafm)). the 32 mailboxes are available for the hcan2. the following table shows the address map for the control, data, timestamp, and lafm/ttt addresses for each mailbox. notes: 1. since mailboxes are in ram, their initial values after a power-on are undefined. be sure to initialize them by writing 0 or 1. 2. set the mailbox configurat ion (mbc) bits of unused ma ilboxes to b'111, and no access is recommended. 3. only word access can be used in message control, timestamp, la fm field. word/bytes access can be used in message data area. 4. when a message is received in the ma ilbox where the lafm is enabled, set id (including ext-id when it is enabled) will be overwritten to the id (ext-id) values of received messages.
rev. 2.00, 09/04, page 446 of 720 mailbox 31 and 0 is a receive-only box, and all the re st of mailboxes (1 to 30) can operate as both receive and transmit mailboxes depending on th e mbc bits. the following table lists the address map of mailboxes and bit assignment.
rev. 2.00, 09/04, page 447 of 720 data bus register name address 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 access size field mbx[0] to [1] h'100 + n * 32 0 stdid[10:0] rtr ide extid [17:16] mbx[2] to [3] h'102 + n * 32 extid[15:0] word (16 bits) mbx[4] to [5] h'104 + n * 32 ccm 0 nmc atx dart mbc[2:0] 0 tct 0 0 dlc[3:0] byte (8 bits) or word (16 bits) control mbx[6] h'106 + n * 32 timestamp[15:0] word (16 bits) timestamp mbx[7] to [8] h'108 + n * 32 msg_data_0 (first rx /tx byte) msg_data_1 mbx[9] to [10] h'10a + n * 32 msg_data_2 msg_data_3 mbx[11] to [12] h'10c + n * 32 msg_data_4 msg_data_5 mbx[13] to [14] h'10e + n*32 msg_data_6 msg_data_7 byte (8 bits) or word (16 bits) data mbx[15] to [16] h'110 + n * 32 local acceptance filter mask 0 (lafm0) mbx[17] to [18] h'112 + n * 32 local acceptance filter mask 1 (lafm1) word (16 bits) lafm note: shaded bits are reserved. the write valu e should always be 0. the read value is not guaranteed. figures 15.3 (standard format) and 15.4 (extended format) show the correspondence between the identifiers (id) and register bit names. sof id-10 id-9 id-0 rtr ide r0 identifier stdid[10:0] figure 15.3 standard format sof id-28 id-27 id-18 srr ide id-17 id-16 id-0 rtr r1 base identifier extended identifier stdid[10:0] extidc[17:0] figure 15.4 extended format the following table lists mailbox settings. an x for register name mbx indicates mailbox number.
rev. 2.00, 09/04, page 448 of 720 register name bit bit name r/w description 15 ? r/w the initial values of these bits are undefined; they must be initialized (by writing 0). 14 to 4 stdid[10:0] r/w set the iden tifier (standard) of data frames and remote frames. 3 rtr r/w remote transmission request used to distinguish between data frames and remote frames. 0: data frame 1: remote frame in a case where the mbc2 to mbc0 bits in mbx[4] = 001 and atx bit in mbx[4] = 1 (in a case where automatic transmission fu nction of data frame is used), this bit will not be overwritten to 1 after receiving remote frame. 2 ide r/w identifier extension used to distinguish between the standard format and extended format. 0: standard format 1: extended format mbx[0], mbx[1] 1, 0 extid[17:16] r/w mbx[2], mbx[3] 15 to 0 extid[15:0] r/w set the identifier (extended) of data frames and remote frames. 15 ccm r/w can-id compare match when this bit is set, the corresponding mailbox receiving a message can trigger two actions. if the tcr9 bit is set to 1, the reception of the message will automatically clear the tcr14 bit (causing icr0 to freeze). if the tcr10 bit is set to 1, the reception of the message will automatically clear the timer counter register (tcntr) and set it to the local offset register (losr) value. note: this function is not supported in this lsi. therefore, the write va lue should always be 0. the read value is not guaranteed. mbx[4], mbx[5] 14 ? r/w the initial values of t hese bits are undefined; they must be initialized (by writing 0).
rev. 2.00, 09/04, page 449 of 720 register name bit bit name r/w description 13 nmc r/w new message control when this bit is cleared to 0, the mailbox of which the rxpr bit is already set does not store the new message but maintains the old one and sets the corresponding bit in umsr. when this bit is set to 1, the mailbox of which the rxpr bit is already set is overwritten with the new message and sets the corresponding bit in umsr. this bit executes the treatment for an unread message also when the remote frame is received. when the remote frame is received, corresponding bits of rfpr (remote request register) and rxpr (receive complete register) registers for the mailbox are set. an unread message is treated according to the settings of this bit and rxpr when the remote frame is received. mbx[4], mbx[5] 12 atx r/w automatic transmission of data frame when this bit is set to 1 and the mailbox receives a remote frame, the corresponding txpr is automatically set and the current contents of the message data is transmitted as a data frame. the scheduling of transmission is still governed by the can identifier. in order to use this function, mbc[2:0] needs to be set to 001. when a transmission is performed by this function, the data length code (dlc) to be used is the one that has been received.
rev. 2.00, 09/04, page 450 of 720 register name bit bit name r/w description 11 dart r/w disable automatic re-transmission when this bit is set to 1, it disables the automatic re- transmission of a message in the event of an error on the can bus or an arbitration lost on the can bus, thereby failed to obta in bus mastership. in effect, when this function is used, the corresponding txcr bit is automatically set at the start of transmission. when this bit is cleared to 0, the hcan2 tries to transmit t he message as many times as required until it is successfully transmitted or it is cancelled by txcr. note: this function is not supported in this lsi. therefore, the write va lue should always be 0. the read value is not guaranteed. 10 to 8 mbc[2:0] r/w mailbox configuration set mailboxes as shown in table 15.2. 7 ? r/w the initial value of this bit is undefined; it must be initialized (by writing 0). 6 tct r/w timer counter transfer when this bit is set to 1, a mailbox is configured as a transmit mailbox, and its dlc is set to 2 or 4 and later, the tcntr value at the sof is included in the two or three bytes of the message data, instead of msg_data_2 and msg_data_3. then value of cycle counter is included in the first byte, instead of msg_data_0. this function will be useful when the hcan2 performs a time mast er role. table 15.3 lists details of configuration of message data area. note: this function is not supported in this lsi. therefore, the write va lue should always be 0. the read value is not guaranteed. mbx[4], mbx[5] 5, 4 ? r/w the initial value of these bits are undefined; they must be initialized (by writing 0).
rev. 2.00, 09/04, page 451 of 720 register name bit bit name r/w description mbx[4], mbx[5] 3 to 0 dlc[3:0] r/w set the data le ngth of a data frame within the range of 0 to 8 bytes. 0000: 0 byte 0001: 1 byte 0010: 2 bytes 0011: 3 bytes 0100: 4 bytes 0101: 5 bytes 0110: 6 bytes 0111: 7 bytes 1xxx: 8 bytes note: x: don?t care
rev. 2.00, 09/04, page 452 of 720 register name bit bit name r/w description mbx[6] 15 to 0 tmstp[ 15:0] r/w timestamp this function is useful to monitor if messages are received/transmitted in appropriate order within the expected schedule. message reception (concerning message received): tcntr value is captured to icr1 at the sof/eof timing which is determined by tcr13 set value, and the icr1 value is stored into this timestamp field of the corresponding mailbox. message transmission (concerning message transmitted): captured by tcr12 for tcntr value when the txpr or txack bit is set. the values are stored into this timestamp field of the corresponding mailbox. mbx[7], mbx[8] mbx[9], mbx[10] mbx[11], mbx[12] mbx[13], mbx[14] 15 to 0 15 to 0 15 to 0 15 to 0 msg_data_0 to msg_data_7 r/w message data fields used for storage for the can message data that is transmitted or received. mbx[7] corresponds to the first data byte (msg_data_0) that is transmitted or received. the bit order on the bus is from bit 15 to 0. 15 ? r/w the initial value of th is bit is undefined; it must be initialized (by writing 0). 14 to 4 stdid_lafm [10:0] r/w local acceptance filter mask for standard id the stdid_lafm filters t he standard identifier of the receive message that is stored in bits 14 to 4 of the mailbox (mbx[0] and mbx[1]). 0: can base id corresponding to the mailbox is enabled (care) 1: can base id corresponding to the mailbox is disabled (don't care) mbx[15], mbx[16] * 3, 2 ? r/w the initial values of these bits are undefined; they must be initialized (by writing 0).
rev. 2.00, 09/04, page 453 of 720 register name bit bit name r/w description mbx[15], mbx[16] * 1, 0 extid_lafm [17:16] r/w mbx[17], mbx[18] * 15 to 0 extid_lafm [15:0] r/w local acceptance filter mask for extended id the extid_lafm filters the extended identifier of the receive message that is stored in the mailbox (mbx[1] to mbx[3]). 0: can extended id corresponding to the mailbox is enabled (care) 1: can extended id corresponding to the mailbox is disabled (don't care) note: * when mbc = b'001, b'010, b'100, and b'101, these re gisters become a local acceptance filter mask (lafm) field. table 15.2 mailbox configuration bit setting mbc[2] mbc[1] mbc[0] data frame transmit remote frame transmit data frame receive remote frame receive remarks 0 0 0 yes yes no no ? not allowed for mailbox 0 ? time-trigger can be used 0 0 1 yes yes no yes ? can be used with atx ? not allowed for mailbox 0 ? lafm can be used 0 1 0 no no yes yes ? allowed for mailbox 0 ? lafm can be used 0 1 1 ? ? ? ? setting prohibited 1 0 0 no yes yes yes ? not allowed for mailbox 0 ? lafm can be used 1 0 1 no yes yes no ? not allowed for mailbox 0 ? lafm can be used 1 1 0 setting prohibited 1 1 1 mailbox inactive
rev. 2.00, 09/04, page 454 of 720 table 15.3 message data area co nfiguration in tct bit setting data bus address 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 access size field name h'108 + n * 32 cycle_counter (first rx/tx byte) msg_data_1 h'10a + n * 32 tcntr[7:0] tcntr[15:8] h'10c + n * 32 msg_data_4 msg_data_5 h'10e + n * 32 msg_data_6 msg_data_7 byte or word data 15.3.17 timer counter register (tcntr) tcntr is a 16-bit readable/writable register. this allows the cpu to monitor the timer counter value and set the free-running timer counter value. setting the tcr11 bit to 1 allows tcmr0 to clear the timer when a timer valu e and tcmr0 (timer compare match 0) matched and the value is set to losr (local offset regi ster). then counting starts. bit bit name initial value r/w description 15 to 0 tcntr15 to tcntr0 all 0 r/w timer count register setting bit 15 (tcr15) in the timer control register (tcr) to 1 enables these bits to be used as a free-running counter. the counter value can be cleared depending on the compare match condition.
rev. 2.00, 09/04, page 455 of 720 15.3.18 timer control register (tcr) tcr is a 16-bit readable/writable register that cont rols the timer operation. this register performs all the settings of periodic transmit condition and restriction. this register should be set before starting timer operation. bit bit name initial value r/w description 15 tcr15 0 r/w enable timer controls on/off of the timer. 0: timer stops running 1: timer starts running notes: 1. the timer does not stop running immediately after this bit is cleared to 0. the timer stops running after an overflow or compare match occurred. 2. the timer malfunctions in this lsi. to prevent the timer from running, the write value to this bit should always be 0. 14 tcr14 0 r/w disable icr0 controls whether to enable or disable the input capture register 0 (icr0). when this bit is set to 1, the timer value is always captured every time a startofframe (sof) appears on the can bus, regardless of whether the hcan2 is a transmitter or receiver. when this bit is cleared to 0, the icr0 value remains latched. 0: icr0 is disabled 1: icr0 is enabled and captures the timer value at every sof [clearing condition] ? can-id of the receive message = mailbox with ccm set (when tcr9 = 1) 13 tcr13 0 r/w timestamp control for reception specifies if the timestamp of each mailbox is recorded at the start of frame (sof) or end of frame (eof). selects icr1 which becomes a trigger of the timestamp for operation in reception. 0: timestamp is recorded at every sof 1: timestamp is recorded at every eof note: in this lsi, timestamp is not recorded at every sof. when using the timestamp in reception, write 1 to this bit.
rev. 2.00, 09/04, page 456 of 720 bit bit name initial value r/w description 12 tcr12 0 r/w timestamp control for transmission specifies if the timestamp operates in corresponding txpr bit or txack bit. use icr1 for timestamp in transmission. 0: timestamp in txpr bit 1: timestamp in txack bit 11 tcr11 0 r/w timer clear/set control by tcmr0 specifies if the timer is to be cleared and set to losr when tcmr0 matches tcntr. note: tcmr0 is capable of generating an interrupt signal to the host processor via irr14. 0: timer is not cleared by tcmr0 1: timer is cleared and set to losr by tcmr0 10 tcr10 0 r/w timer clear/set control by ccm specifies if the timer is to be cleared and set to losr by can-id compare match (ccm) when a mailbox receives a message, only when the ccm bit of the corresponding mailbox and this bit are both set. note: ccm cannot generate an interrupt signal. this can be performed by irr1 or irr2. 0: timer cannot be cleared by ccm 1: timer is cleared by ccm and set to losr 9 tcr9 0 r/w icr0 automatic disable by ccm specifies if icr0 is to be disabled by can-id compare match (ccm) when a mailbox stores a receive message. when a mailbox stores a receive message, tcr14 (bit 14) of this register is autom atically cleared and the icr0 value is retained, only if the ccm bit of the corresponding mailbox and this bit are both set. 0: tcr14 is not cleared 1: tcr14 is automatically cleared 8 to 6 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
rev. 2.00, 09/04, page 457 of 720 bit bit name initial value r/w description 5 4 3 2 1 0 tpsc5 tpsc4 tpsc3 tpsc2 tpsc1 tpsc0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w hcan2 timer prescaler used to divide the source clock (2 hcan-2 system clock). 000000: 1 source clock 000001: 2 source clock 000010: 4 source clock 000011: 6 source clock : 111110: 124 source clock 111111: 126 source clock 15.3.19 timer status register (tsr) tsr is a 16-bit read-only register that indicates generation of the timer compare match and timer overflow. bit bit name initial value r/w description 15 to 3 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 2 tsr2 0 r compare match flag 1 indicates that a compare-match condition occurred in compare match register 1 (tcmr1). when the value set in tcmr1 matches the timer value (tcmr1 = tcntr), this bit is set. note: this bit is not set if the tcmr1 value is h'0000. also, this bit is read-only and is cleared when irr15 (timer compare match interrupt 1) is cleared. 0: timer compare match has not occurred 1: timer compare match has occurred (tcmr1) [clearing condition] ? writing 1 to irr15 [setting condition] ? tcmr1 = tcntr
rev. 2.00, 09/04, page 458 of 720 bit bit name initial value r/w description 1 tsr1 0 r compare match flag 0 indicates that a compare-match condition occurred in compare match register 0 (tcmr0). when the value set in tcmr0 matches the timer value (tcmr0 = tcntr), this bit is set. note: this bit is not set if the tcmr0 value is h'0000. also, this bit is read-only and is cleared when irr14 (timer compare match interrupt flag 0) is cleared. 0: timer compare match has not occurred 1: timer compare match has occurred (tcmr0) [clearing condition] ? writing 1 to irr14 [setting condition] ? tcmr0 = tcntr 0 tsr0 0 r timer overflow flag indicates that the timer has overflowed and is reset to h'0000. 0: timer has not overflowed 1: timer has overflowed [clearing condition] ? writing 1 to irr13 [setting condition] ? when the timer value changes from h'ffff to h'0000 15.3.20 local offset register (losr) losr is a 16-bit readable/writable re gister. the purpose of this regist er is to set a local offset to the timer counter (tcntr). whenever tcntr is cleared by overflow, timer compare match, or can-id compare match, tcntr starts counting from the value set in this register. bit bit name initial value r/w description 15 to 0 losr15 to losr0 all 0 r/w local offset register when the timer counter (tcntr) is cleared by overflow, timer compare match, or can-id compare match, tcntr starts counting from the value set in losr.
rev. 2.00, 09/04, page 459 of 720 15.3.21 input capture regi sters 0 and 1 (icr0, icr1) icr0 and icr1 are 16-bit readable/writable (wor d-access only) registers. the initial values are h'0000. (these registers are abbreviated to icr0 and icr1 in this section.) icr0: icr0 can be used for a global synchronization purpose. the timer value is captured at the point specified by bit 13 in the timer control register (tcr) as long as it is enabled by bit 14 in tcr, regardless of whether or not the received me ssage matches the identifiers set in the receive mailboxes. if it is disabled by bit 14 in tcr, icr0 holds the current value. icr1: icr1 is used to record the timestamp for messa ges to be transmitted and received. bit 13 in tcr controls at which point the timestamp should be recorded. the difference between icr1 and icr0 is that icr1 cannot be disabled so th e timestamps recorded on messages are always accurate. 15.3.22 timer compare match registers 0 and 1 (tcmr0 and tcmr1) tcmr0 and tcmr1 are 16-bit readable/writable registers. it allows generation of the interrupt signal and clearing of the timer values (tcmr0 only). tcmr0 and tcmr1 have entirely the same function (except timer clearing). interrupt: the interrupt from each of tcmr1 and tcmr 0 is flagged in bits 15 and 14 in irr just in such order. these flags cannot be masked (on generation of a compare match) but generation of the interrupt signal can be masked by setting the imr15 and imr14 bits. if tcmr is set to h 0000, no compare match will be generated. if a compare match is generated, bit 2 (or bit 1) in tsr (timer status regist er) will also be set. if the irr15 bit (or irr14 bit) is set and the irr bit is cleared, the correspond ing tsr bit will also be cleared. timer clearing and setting: the timer value can only be cl eared by tcmr0 and set by losr. if a compare match is generated when bit 11 in t cr is set, the timer value will be cleared. tcmr1 have no such function. bit bit name initial value r/w description 15 to 0 tcmrn[15] to tcmrn[0] (n = 0 and 1) all 0 r/w timer compare match register (tcmrn) tcmr0 and tcmr1 generate the interrupt signal by a compare match with the timer (tcntr). tcmr0 allows interrupts and timer values to be cleared.
rev. 2.00, 09/04, page 460 of 720 15.4 operation 15.4.1 hardware and software resets the hcan2 can be reset by hardware or software. ? hardware reset at power-on reset, manual reset, or in hardware or software standby mode, the hcan2 is initialized by automatically setting the reset request bit (mcr0) in mcr and the reset status bit (gsr3) in gsr. at the same time, all inte rnal registers, except for mailboxes (mb0 to mb31), are initialized by a hardware reset. figure 15.5 shows a flowchart in a hardware reset. ? software reset in the normal operating state, the hcan2 can be reset by setting the reset request bit (mcr0) in mcr (software reset). in a software re set, if the can controller is performing a communication operation (t ransmission or reception), the hcan2 enters the initialization state after message transmission or reception has comp leted. a software reset is enabled after the hcan2 has entered from the bus off state to the error active state. the reset status bit (gsr3) in gsr is set during initialization. in this initialization, error counters (tec and rec) are initialized, but other registers and ram are not initialized. figure 15.6 shows a flowchart in a software reset. 15.4.2 initialization after hardware reset after a hardware reset, the following initialization processing should be carried out: 1. clearing of irr0 bit in the interrupt request register (irr) 2. port settings of hcan2 pins 3. bit rate setting 4. mailbox (ram) initialization 5. mailbox transmit/receive settings 6. message transmission method setting these initial settings must be made while the hcan2 is in configuration mode. configuration mode is a state in which the gsr3 bit in gsr is se t by a reset. if the mcr0 bit in mcr is cleared to 0, for a while, configuration mode is aborte d shortly after the hcan2 automatically clears the gsr3 bit in gsr. there is a delay between cl earing the mcr0 bit and clearing the gsr3 bit because the hcan2 needs time to be internally re set. after the hcan2 exits configuration mode, the power-up sequence begins, and communication with the can bus is possible as soon as 11 consecutive recessive bits have been detected.
rev. 2.00, 09/04, page 461 of 720 irr0 clearing: the reset interrupt flag (irr0) is always set after a power-on reset or recovery from software standby mode. as an hcan2 interrupt is initiated immediately when interrupts are enabled (in the state in which the interrupt mask register (imr0) is cleared), irr0 should be cleared. hardware reset mcr0 = 1 (automatic) set bcr irr0 = 1 (automatic) gsr3 = 1 (automatic) gsr3 = 0 & 11 recessive bits received? can bus communication enabled yes no bit configuration mode period in which bcr, mbc, etc., are initialized : settings by user : processing by hardware mcr0 = 0 initialization of hcan2 module clear irr0 hcan2 port setting bcr setting mbc setting mailbox initialization message transmission method setting imr setting (interrupt mask setting) mbimr setting (interrupt mask setting) mb[x] setting (receive identifier setting) lafm setting (receive identifier mask setting) figure 15.5 hardware reset flowchart
rev. 2.00, 09/04, page 462 of 720 irr0 = 1 (automatic) gsr3 = 1 (automatic) bit configuration mode period in which bcr, mbc, etc., are initialized : settings by user : processing by hardware mcr0 = 1 bus idle? yes yes yes no no no initialization of tec and rec gsr3 = 1? mcr0 = 0 set bcr clear irr0 hcan2 port setting bcr setting mbc setting mailbox initialization message transmission method setting imr setting (interrupt mask setting) mbimr setting (interrupt mask setting) mbx setting (receive identifier setting) lafm setting (receive identifier mask setting) gsr3 = 0 & 11 recessive bits received? can bus communication enabled figure 15.6 software reset flowchart hcan2 pin port settings: hcan2 pin port settings must be made during or before entering configuration mode. refer to section 17, pin function controller (pfc), for details of the setting method.
rev. 2.00, 09/04, page 463 of 720 bit rate and bit timing settings: the bit rate and bit timing settings are made in the bit configuration register (bcr). settings should be ma de such that all can controllers connected to the can bus have the same baud rate and bit width. the 1-bit time consists of the total of the settable time quanta (tq). figure 15.7 shows details of the 1-bit time. sync_seg prseg phseg1 phseg2 time segment 2 (tseg2) time segment 1 (tseg1) 1-bit time (8 to 25 time quanta) 4 to 16 time quanta 2 to 8 time quanta 1 time quanta figure 15.7 detailed de scription of 1-bit time sync_seg is a segment for establishing the synchronization of nodes on the can bus. normal bit edge transitions occur in this segment. prse g is a segment for compen sating for the physical delay between networks. phseg1 is a buffer segm ent for correcting phase drift (positive). this segment is extended when synchronization (resynchronization) is performed. phseg2 is a buffer segment for correcting phase drift (negative). this segment is shortened when synchronization (resynchronization) is performed. limits on the bcr settable values (tseg1, tseg2, brp, sample point, and sjw) are shown in table 15.4. table 15.4 limits on bcr settable values name abbreviation min. value max. value time segment 1 tseg1 4 * 3 16 time segment 2 tseg2 2 * 2 8 baud rate prescaler brp 1 256 bit sample point bsp 1 3 re-synchronization jump width sjw * 1 1 4 notes: 1. sjw is stipulated in the can specifications: 4 sjw 1 2. the minimum value of tseg2 is stipulated in the can specifications: tseg2 sjw 3. the minimum value of tseg1 is stipulated in the can specifications: tseg1 > tseg2 stipulated as: tseg1 + tseg2 + 1 = 8 to 25 tq (time quanta)
rev. 2.00, 09/04, page 464 of 720 time quanta (tq) is an integer multiple of the nu mber of system clocks, and is determined by the baud rate prescaler (brp) as follows. f clk means the hcan2 clock ( /2). tq = (brp setting + 1)/f clk the following formula is used to calculate the 1-bit time and bit rate. 1-bit time = tq (1 + tseg1 + tseg2) bit rate = 1/bit time = f clk /{(tq number set by brp) (1 + tq number set by tseg1 + tq number set by tseg2)} note: f clk = /2 (system clock is divided by 2) the tq value of bcr is used for brp, tseg1, and tseg2. example: with = 40 mhz, brp = b'000001 (2tq), tseg1 = b'0100 (5tq), and tseg2 = b'011 (4tq): bit rate = 20/{(2) (1 + 5 + 4)} = 1 mbps table 15.5 setting range for tseg1 and tseg2 in bcr tseg2 (bcr[10:8]) 001 * 010 011 100 101 110 111 tq value 2 3 4 5 6 7 8 tseg1 0011 4 no yes no no no no no (bcr[15:12]) 0100 5 yes yes yes no no no no 0101 6 yes yes yes yes no no no 0110 7 yes yes yes yes yes no no 0111 8 yes yes yes yes yes yes no 1000 9 yes yes yes yes yes yes yes 1001 10 yes yes yes yes yes yes yes 1010 11 yes yes yes yes yes yes yes 1011 12 yes yes yes yes yes yes yes 1100 13 yes yes yes yes yes yes yes 1101 14 yes yes yes yes yes yes yes 1110 15 yes yes yes yes yes yes yes 1111 16 yes yes yes yes yes yes yes note: * when brp[7:0] are b'00000000, tse g[2:0] should not be set to b'001.
rev. 2.00, 09/04, page 465 of 720 mailbox initial settings: mailboxes are held in ram, and so their initial valu es are undefined after power is supplied. initial values must therefore be set in all the mailboxes (by writing 0s or 1s). mailbox transmit /receive settings: the hcan2 has 32 mailboxes. mailbox 31 and 0 are receive-only, while mailboxes 1 to 30 can be set for transmission or reception. use mbc[2:0] bits in the mailbox to set the corr esponding mailbox for transmission or reception use. when setting mailboxes for reception, in or der to improve message reception efficiency, high-priority messages should be set in mailboxes with high mailbox number. set mbc[2:0] bits of unused mailbox es to b'111 and do not access them. note: restrictions apply to the use of the mail box 31 for transmission. carefully read section 15.8, usage notes. message transmission method setting : the following two kinds of message transmission methods are available. ? transmission order determined by message identifier priority ? transmission order determined by mailbox number priority either of the message transmission methods can be selected with the message transmission method bit (mcr2) in the master control register (m cr): when messages are set to be transmitted according to the message identifier priority, if several messages are designated as waiting for transmission (txpr = 1), depending on the settings of the message identifier, ide, ext-id, and rtr bit, the message with the highest priority (s et values of the identifier, ide, ext-id, and rtr bit are low) is stored in the transmit buffer. can bus arbitration is then carried out for the message stored in the transmit buffer, and the messa ge is transmitted when the transmission right is acquired. when the txpr bit is set, the highest-priority message is found and stored in the transmit buffer. when messages are set to be transmitted according to the mailbox number proiority, if several messages are designated as waiting for transmission (txpr = 1), the message with the highest mailbox number is stored in the transmit buffer . can bus arbitration is then carried out for the message stored in the transmit buffer, and the messa ge is transmitted when the transmission right is acquired.
rev. 2.00, 09/04, page 466 of 720 15.4.3 message transmission by event trigger messages are transmitted using mailboxes 1 to 31. th e transmission procedure after initial settings is described below, and a transmission flowchart is shown in figure 15.8. initialization (after hardware reset only) hcan2 port setting clear irr0 bcr setting mbc setting mailbox initialization message transmission method setting yes no yes yes : settings by user : processing by hardware no no interrupt settings transmit data setting arbitration field setting control field setting data field setting message transmission gsr2 = 0 (during transmission only) txack = 1 irr8 = 1 clear txack clear irr8 message transmission wait txpr setting bus idle? transmission completed? imr8 = 1? interrupt to cpu (sle1) end of transmission figure 15.8 transmission flowchart by event trigger
rev. 2.00, 09/04, page 467 of 720 cpu interrupt source settings: the cpu interrupt source is set by the interrupt mask register (imr) and mailbox interrupt mask register (mbimr). transmission acknowledge and transmission abort acknowledge interrupts can be generated for individual mailboxes in the mailbox interrupt mask register (mbimr). arbitration field setting: the arbitration field is set by message control mbx[0] to mbx[3] in a transmit mailbox. for a standard format, an 11-b it identifier (stdid[28] to stdid[18]) and the rtr bit are set, and the ide bit is cleared to 0. for an extended format , a 29-bit identifier (stdid[28] to stdid[0], extid[17] to extid[0] ) and the rtr bit are set, and the ide bit is set to 1. control field setting: in the control field, the byte length of the data to be transmitted is set within the range of zero to eight bytes. the register to be set is the dlc3 to dlc0 bits in the message control mbx[4] to mbx[5] in a transmit mailbox. data field setting: in the data field, the data to be transmitted is set within the range zero to eight bytes. the registers to be set are the message data msg_data_0 to msg_data_7. the byte length of the data to be transmitted is determined by the data length code (dlc[3:0]) in the control field. even if data exceeding the valu e set in the control field is set in the data field, up to the byte length set in the control field will actually be transmitted. message transmission: if the corresponding mailbox transmit wait bit in the transmit wait register (txpr) is set to 1 after message contro l and message data have been set, the message enters the transmit wait state. if the message is transmitted error-fr ee, the corresponding acknowledge bit in the transmit acknowledge regist er (txack) is set to 1, and the corresponding transmit wait bit in the transmit wait register (txpr) is automatically cleared to 0. also, if the corresponding bit in the mailbox interrupt ma sk register (mbimr) and the mailbox empty interrupt bit (imr8) in the interrupt mask register (imr) are both simultan eously set to enable interrupts, interrupts (sle1) may be sent to the cpu. if transmission of a transmit message is abor ted in the following cases, the message is retransmitted automatically: ? can bus arbitration failure (failure to acquire the bus) ? error during transmission (bit error, stuff er ror, crc error, frame error, or ack error) message transmission cancellation: transmission cancellation can be specified for a message stored in a mailbox as a transmit wait message. a transmit wait message is canceled by setting the corresponding mailbox bit to 1 in the transmit wa it cancel register (txcr) . clearing the transmit wait register (txpr) does not cancel transmission . when cancellation is ex ecuted, the transmit wait register (txpr) is automatically reset, an d the corresponding bit is set to 1 in the abort acknowledge register (aback). an interrupt to the cpu can be requested. also, if the corresponding bit (mbimr1 to mbimr31) in the mailbox interrupt mask register (mbimr) and
rev. 2.00, 09/04, page 468 of 720 the mailbox empty interrupt bit (imr8) in the interrupt mask register (imr) are both simultaneously set to enable interrupts, interrupts may be sent to the cpu. however, a transmit wait message cannot be canceled at the following times: ? during internal arbitration or can bus arbitration ? during data frame or re mote frame transmission figure 15.9 shows a flowchart for transmit message cancellation. message transmit wait txpr setting yes no yes no : settings by user : processing by hardware set txcr bit corresponding to message to be canceled message not sent clear txcr and txpr aback = 1 irr8 = 1 clear txack clear aback clear irr8 completion of message transmission txack = 1 clear txcr and txpr irr8 = 1 cancellation possible? imr8 = 1? end of transmission/transmission cancellation interrupt to cpu (sle1) figure 15.9 transmit message cancellation flowchart
rev. 2.00, 09/04, page 469 of 720 15.4.4 message reception follow the procedure below to perf orm message recep tion after initial sett ing. figure 15.10 shows a flowchart in reception. rxpr irr1 = 1 no imr2 = 1? interrupt to cpu (rm1) yes no yes yes yes no : settings by user : processing by hardware no yes initialization clear irr0 hcan2 port setting bcr setting mbc setting mailbox (ram) initialization receive data setting arbitration field setting local acceptance filter settings interrupt settings message reception? (match of identifier in mailbox?) same rxpr = 1? imr1 = 1? data frame? interrupt to cpu (rm1) clear irr1 end of reception clear irr2 and irr1 unread message (remote frame) no rxpr, rfpr = 1 irr2 = 1, irr1 = 1 message control read message data read message control read message data read transmission of data frame corresponding to remote frame figure 15.10 flowchart in reception
rev. 2.00, 09/04, page 470 of 720 cpu interrupt source settings: cpu interrupt source settings are made in the interrupt mask register (imr) and mailbox inte rrupt register (mbimr). the me ssage to be received is also specified. data frame and remote frame receive wait interrupt requests can be generated for individual mailboxes in the mbimr. arbitration field setting: to receive a message, the message id entifier must be set in advance in the message control (mbx[0] to mb x[5]) for the receiving mailbox. when a message is received, all the bits in the receive mess age identifier are comp ared with those in each message control register identifier, and if a complete match is found, the message is stored in the matching mailbox. mailboxes have a local acceptance filter mask (lafm) that allows don't care settings to be made. by making the don't care setting for all the bits in the receive message identifier, messages of multiple identif iers can be received. examples: ? when the identifier of mailbox 1 is 010_1010_1010 (standard format) and the lafm setting is 000_0000_0000 (0: care, 1: don't care), only one kind of message identifier can be received by mailbox 1: identifier 1: 010_1010_1010 ? when the identifier of mailbox 0 is 010_1010_1010 (standard format) and the lafm setting is 000_0000_0011 (0: care, 1: don't care), a total of four kinds of message identifiers can be received by mailbox 0: identifier 1: 010_1010_1000 identifier 2: 010_1010_1001 identifier 3: 010_1010_1010 identifier 4: 010_1010_1011 message reception: when a message is received, a crc check is performed automatically. if the result of the crc check is normal, ack is transm itted in the ack field irrespective of whether the message can be received or not. ? data frame reception if the received message is confirmed to be erro r-free by the crc check, the identifier of the receive message and the identifier in the mailb ox (including lafm), are compared. if a complete match is found, the message is stor ed in the mailbox. the message identifier comparison is carried out on each mailbox in turn, starting with mailbox 31 and ending with mailbox 0. if a complete match is found, the comparison ends at that point, the message is stored in the matching mailbox, and the corresponding receive complete bit (rxpr0 to rxpr31) is set in the receive co mplete register (rxpr). when a message is received, if id comparison is carried out and identifiers match in multiple mailboxes (including lafm), only the mailbox with the highest mailbox number can receive the message. on receiving a message, a cpu interrupt request (rm1) may be generated depending on the mailbox interrupt mask register (mbimr) and interrup t mask register (imr) settings.
rev. 2.00, 09/04, page 471 of 720 ? remote frame reception two kinds of messages?data frames and remote frames?can be stored in mailboxes. a remote frame differs from a data frame in that the value of the remote transmission request bit (rtr) in the message control and the data field are 0 bytes long. the data length to be returned in a data frame must be stored in the data length code (dlc) in the control field. when a remote frame (rtr = rece ssive) is received, th e corresponding bit is set in the remote request wait register (rfpr). if the corresponding bit (mbimr0 to mbimr31) in the mailbox interrupt mask register (mbimr) and the remote frame request interrupt mask (irr2) in the interrupt mask register (imr) are set to the interrupt enable value at this time, an interrupt request (rm1) can be sent to the cpu. unread message overwrite: if the receive message identifier matches the mailbox identifier, the receive message is stored in the mailbox regardle ss of whether the mailbox contains an unread message or not. if a message overwrite occurs, the corresponding bit (umsr0 to umsr31) is set in the unread message register (umsr). in overwriting an unread message, when a new message is received before the correspondin g bit in the receive complete re gister (rxpr) has been cleared, the unread message register (umsr) is set. if the unread interrupt flag (irr9) in the interrupt mask register (imr) is set to the interrupt enable va lue at this time, an interrupt can be sent to the cpu. figure 15.11 shows a flowchart for unread message overwriting. no : settings by user unread message overwrite interrupt to cpu (ovr1) end imr9 = 1? umsr = 1 irr9 = 1 clear irr9 message control/message data read : processing by hardware yes figure 15.11 unread me ssage overwrite flowchart
rev. 2.00, 09/04, page 472 of 720 15.4.5 mailbox reconfiguration follow the procedure below to perform mailbox reconfiguration. ? ensure that no corresponding txpr is set that changes the transmit box id or changes the transmit box into the receive box. any iden tifier and the corresponding mbc bit can be changed any time. when changing both, change the identifier before changing the corresponding mbc bit. ? change the receive box id or change the receive box into the transmit box. using halt mode the advantage of this method is that no messag es are lost as far as a message exists in the can bus at that time and the hcan2 becomes a receiver. upon completion of reception, the hcan2 enters halt mode. the disadvantages are that reconfiguration takes time if the hcan2 is in the middle of receiving messages (transiti on to halt mode is dela yed until reception ends) and no message reception/transmi ssion is possible in halt mode. not using halt mode the advantage of this method is that reconfiguration is immediately performed and the software overhead is small as if no interrupts were existent. reading rxpr, which is necessary before and after reconfiguration, is for the purpose of checking if messages are received during this period. no te that mbimr simply prevents the interrupt signal from occurrence instead of preventing the rxpr bit from being set. when any message is received, it is unclear whether such message belongs to a previous or new id. accordingly, messages received during this period sh ould be discarded, which is th e disadvantage of this method.
rev. 2.00, 09/04, page 473 of 720 is hcan2 transmitter, receiver, or bus off? hcan2 is in normal mode method-1 (halt mode) method-2 (on-the-frv) hcan2 is in normal mode set corresponding mbim bit change id or mbc of mailbox read corresponding rxpr bit clear corresponding rxpr abandon the received msg clear corresponding mbim bit hcan2 is in normal mode and ready for action hcan2 is in normal mode hcan2 is in halt mode change id or mbc of mailbox clear mcr1 the shadowed boxes need to be done by s/w (host processor) set mcr[1] (halt mode) generate interrupt (irr0) read irr0 & gsr4 as 1 read corresponding rxpr (rfpr) bit as 0 0 ye s no ye s finish current session cear rxpr no 1 figure 15.12 change of receive box id a nd change from receive box to transmit box 15.4.6 hcan2 sleep mode the hcan2 is provided with an hcan2 sleep mode that pl aces the hcan2 module in the sleep state in order to reduce current dissipation. figure 15.13 shows a flowchart of hcan2 sleep mode.
rev. 2.00, 09/04, page 474 of 720 irr12 = 1 yes mcr5 = 0 yes yes mcr5 = 0 clear sleep mode? yes yes no no no yes (automatic) no (manual) mcr5 = 1 bus idle? retain tec and rec can bus operation? : settings by user : processing by hardware no no imr12 = 1? sleep mode clearing method mcr7 = 1? 11 recessive bits received? can bus communication possible cpu interrupt (ovr1) figure 15.13 hcan2 sleep mode flowchart
rev. 2.00, 09/04, page 475 of 720 hcan2 sleep mode is entered by setting the hcan2 sleep mode bit (mcr5) to 1 in the master control register (mcr). if the can bus is opera ting, the transition to hcan2 sleep mode is delayed until the bus becomes idle. following flow is recommended to enter sleep mode. 1. set halt mode (mcr1 = 1). 2. confirm that the hcan2 is disconn ected from the can bus (gsr4 = 1). 3. clear the source register that controls irr. 4. clear halt mode and set bits for sleep mode simultaneously (mcr1 = 0 and mcr5 = 1). either of the following methods of clear ing hcan2 sleep mode can be selected: ? clearing by software ? clearing by can bus operation 11 recessive bits must be received after hcan2 sleep mode is cleared before can bus communication is re-enabled. clearing by software: hcan2 sleep mode is cleared by wr iting a 0 to mcr5 from the cpu. clearing by can bus operation: the cancellation method is sel ected by the mcr7 bit setting in mcr. clearing by can bus operation occurs automatically when the can bus performs an operation and this change is detected. in this case, the first message is not stored in a mailbox; messages will be received normally from the second message onward. when a change is detected on the can bus in hcan2 sleep mode, the bus operation interrupt flag (irr12) is set in the interrupt register (irr). if the bus interrupt mask (imr12) in the interrupt mask register (imr) is set to the interrupt enable value at this time, an interrupt can be sent to the cpu.
rev. 2.00, 09/04, page 476 of 720 15.4.7 hcan2 halt mode the hcan2 halt mode is provided to enable mailbox settings to be changed without performing an hcan2 hardware or software reset. in hcan2 halt mode, the contents of all registers are retained. figure 15.14 shows a flowchart of hcan2 halt mode. no : settings by user : processing by hardware can bus communication possible mcr1 = 1 gsr4 = 1? ? bus idle? mcr1 = 0 11 recessive bits received mailbox setting yes yes yes no no no figure 15.14 hcan2 halt mode flowchart hcan2 halt mode is entered by setting the halt request bit (mcr1) to 1 in the master control register (mcr). if the can bus is operating, the transition to hcan2 halt mode is delayed until the bus becomes idle. hcan2 halt mode is cleared by clearing mcr1 to 0.
rev. 2.00, 09/04, page 477 of 720 15.5 interrupt sources table 15.6 lists the hcan2 interrupt sources. with the exception of the reset processing interrupt (irr0) by a power-on reset, these sources can be masked. masking is implemented using the mailbox interrupt mask register (mbimr) and interrupt mask register (imr). for details on the interrupt vector of each interrupt source, refer to section 6, interrupt controller (intc). table 15.6 hcan2 interrupt sources name description interrupt flag dtc activation error passive interrupt (tec 128 or rec 128) irr5 bus off interrupt (tec 256)/bus off recovery interrupt irr6 error warning interrupt (tec 96) irr3 ers1 error warning interrupt (rec 96) irr4 not possible reset processing interrupt by power-on reset irr0 overload frame transmission interrupt irr7 unread message overwrite/overrun irr9 detection of can bus operation in hcan2 sleep mode irr12 timer overflow irr13 compare-match condition occurred in tcmr0 irr14 ovr1 compare-match condition occurred in tcmr1 irr15 not possible data frame reception irr1 rm1 remote frame reception irr2 possible sle1 mailbox empty irr8 not possible
rev. 2.00, 09/04, page 478 of 720 15.6 dtc interface the dtc can be activated by the reception of a message in hcan2 mailbox 0. when dtc transfer ends after dtc activation has been set, the rxpr0 and rfpr0 flags are cleared automatically. an interrupt request due to a receive interrupt from the hcan2 cannot be sent to the cpu in this case. figure 15.1 5 shows a dtc transfer flowchart. dtc initialization dtc enable register setting dtc register information setting yes yes : settings by user : processing by hardware no no message reception in hcan2?s mailbox 0 transfer counter = 0 or disel = 1? dtc activation end of dtc transfer? rxpr and rfpr clearing interrupt to cpu end figure 15.15 dtc transfer flowchart
rev. 2.00, 09/04, page 479 of 720 15.7 can bus interface a bus transceiver ic is necessary to connect this lsi to a can bus. a renesas ha13721 transceiver ic and its compatible products are recommended. figure 15.16 shows a sample connection diagram. mode rxd txd nc vcc canh canl gnd hrxd1 nc note: nc: no connection htxd1 this lsi can bus 120 ? 120 ? vcc ha13721 figure 15.16 high-speed interface using ha13721 15.8 usage notes 15.8.1 time trigger transmit se tting/timer operation disabled ? the timer should not be operated during event trigger transmission (tcr15 = 0), or event trigger may not be executed normally. 15.8.2 reset the hcan2 is reset by a power-on reset, in hardware standby mode, and in software standby mode. all the registers are initialized in a reset, but mailboxes mbx are not. after power-on, however, mailboxes mbx are initialized, and thei r values are undefined. therefore, mailbox initialization must always be carried out after a power-on reset, a transition to hardware standby mode, or software standby mode. the reset interrupt flag (irr0) is always set after a power-on reset or recovery from software standby mode. as this bit cannot be masked in the interrupt mask register (imr), if hcan2 interrupt enabling is set in the interrupt controller without clearing the flag, an hcan2 interrupt will be initiated immediately. irr0 should therefore be cleared during initialization.
rev. 2.00, 09/04, page 480 of 720 15.8.3 hcan2 sleep mode the bus operation interrupt flag (irr12) in the interrupt register (irr) is set by can bus operation in hcan2 sleep mode. therefore, this flag is not used by the hcan2 to indicate sleep mode release. note that the reset status bit (gsr3) in the general status register (gsr) is set in hcan2 sleep mode. 15.8.4 interrupts when the mailbox interrupt mask register (mbimr) is set, the interrupt register (irr8, irr2, or irr1) is not set by reception completion, transmission completion, or transmission cancellation for the set mailboxes. 15.8.5 error counters in the case of error active and er ror passive, rec and tec normally count up and down. in the bus-off state, 11-bit recessive se quences are counted (r ec + 1) using rec. if rec reaches 96 during the count, irr4 and gsr1 are set, and if rec reaches 128, irr7 is set. 15.8.6 register access hcan2 registers except some registers can be accessed only in words. the registers for mailboxes, mbx[4], mbx[ 5], and mbx[7] to [14], can be acce ssed in both bytes and words. the registers should not be accessed in longwords. 15.8.7 register in standby modes all hcan2 registers are initialized in hardware standby mode and software standby mode. 15.8.8 transmission cancellati on during sof or intermission setting the contents of txcr at the sof or in the intermission state causes a message transmission and txack to be set at the comple tion of the transmission. however, clearing the contents of txcr and txpr and setting the cont ents of aback are automatically performed. despite that both transmission-can cellation and transmission-comple tion flags are set, incorrect data will not transmitted.
rev. 2.00, 09/04, page 481 of 720 15.8.9 cases when the transmit wait regi ster (txpr) is set during transfer of eof if the transmit wait register (txpr) is set du ring transfer of eof for the message being transmitted or received, no rmal transfer of the data may be inhibited. ? conflict with eo f during message reception: the r eception might not proceed normally because the data received at the previous recep tion may not be stored at the reception of the next sof. ? conflict with eof during message transmission: the transmi ssion might not proceed normally because the id of the next data for transmis sion may have been damaged. transmission will proceed normally when the txpr bits are set by package to all the mailboxes that require transmission after all of the data for transmission have been transmitted. the occurrence of the phenomena described above depends on the settings of the operating clock and baud rate for the hcan2, the number of transmission mailboxes set in the txpr register, and the number of times the mailboxes are accessed by th e cpu after the txpr register has been set. software measure: program so that the txpr bits are set by package to all the mailboxes that require transmission wait until the transmission from all of the speci fied mailboxes and the reception from the can bus are completed, confirm that the txpr has been cleared and rxpr set to 1, then set the txpr again. 15.8.10 limitation on access to the local acceptance filter mask (lafm) read access to the local acceptance filter mask register (lafm) during message transmission may damage the data in the register. software measure: program so th at the lafm register is only accessed in the configuration mode (mcr0 = 1) 15.8.11 notes on using auto acknowledge mode in the self test by setting the tst4 bit (auto acknowledge mode) in the master control register (mcr) to 1, transmission can be performed but receiving the tran smit data cannot be performed. 15.8.12 notes on usage of the transmit wait cancel register (txcr) ? if a transmit wait cancel register (txcr) setting to cancel transmission is made immediately after a transmission request (txpr) has been is sued at the sof or during an intermission, canceling of the message being prep ared for transmission is not possible so that transmission
rev. 2.00, 09/04, page 482 of 720 will start and proceed normally. in such a case, however , incorrect clearing of the transmit wait register (txpr) and setting of the flag in the abort acknowledge regist er (aback) may occur. ? transmitting cancellation of mailbox 31 cannot be performed by event trigger transmit. note: mailbox 31 should be used for reception. 15.8.13 setting and cancellation of transmission during bus-idle state after a transmission request has been issued (txpr is set) while in the bus-idle state, if another transmission request is issued (txpr is set) or the transmission is cancelled (txcr is set) immediately before the sof, transmission may not be carried out correctly. software measure: ? program so that the txpr bits are set by package to all the mail boxes that require transmission wait until the transmission from a ll of the specified mailboxes is completed, confirm that the txpr has been cleared to 0, then set the txpr again. ? to cancel transmission, allow more than 50 s after the txpr register has been set, then set the txcr. the values of the time interval from txpr setti ng to txcr setting, indicated above, is for a guide. for further details, please contact your nearest renesas technology sales office. 15.8.14 releasing hcan2 reset before releasing hcan2 software reset mode (mcr0 = 0), confirm in advance that the reset status bit (gsr3) is set to 1. 15.8.15 accessing mailboxes when hcan2 is in sleep mode mailboxes should not be accessed when the hcan2 is in sleep mode. if mailboxes are accessed in sleep mode, the cpu may stop. however, the cpu does not stop when registers that are not relevant to mailboxes are accessed in sleep mode or mailboxes are accessed in other modes. 15.8.16 module standby mode setting hcan2 operation can be disabled or enabled using the module standby control register. the initial setting is for hcan2 operation to be halte d. register access is enabled by clearing module standby mode. for details, refer to section 24, power-down modes.
rev. 2.00, 09/04, page 483 of 720 section 16 motor management timer (mmt) motor management timer (mmt) can output 6-phase pwm waveforms with non-overlap times. figure 16.1 shows a block diagram of the mmt. 16.1 features ? triangular wave comparison type 6-phase pwm waveform output with non-overlap times ? non-overlap times generated by timer dead time counters ? toggle output synchronized with pwm period ? counter clearing on an external signal ? data transfer by dtc activation ? generation of a trigger for the start of conve rsion by the a/d converter is available. ? output-off functions ? pwm output halted by external signal ? pwm output halted when oscillation stops ? module standby mode can be set
rev. 2.00, 09/04, page 484 of 720 tgruu +2td +td +2td +td +2td +td tgru tgrud tgrvu tgrv tgrvd tgrwu tgrw tgrwd mmt_tmdr pcio puoa puob pvoa pvob pwoa pwob a/d start-conversion request signal tcnr mmt_tsr tbru tbrv tbrw tpbr tpdr 2 +2td tpdr compare match interrupt 2td compare match interrupt mmt_tddr tdcnt0 comparators control circuit magnitude comparators mmt_tcnt p to p /1024 comparators [legend] tgr: tbr: mmt_tddr: tpdr: tpbr: td: timer general register timer buffer register timer dead time data register timer period data register timer period buffer register dead time mmt_tmdr: tcnr: mmt_tsr: mmt_tcnt: tdcnt: p : timer mode register timer control register timer status register timer counter timer dead time counter peripheral clock figure 16.1 block diagram of mmt
rev. 2.00, 09/04, page 485 of 720 16.2 input/output pins table 16.1 shows the pin configuration of the mmt. table 16.1 pin configuration name i/o function pcio input/output counter clear signa l input when set as an input by paiorl register: toggle output in synchronization with the pwm cycle when set as an output by paiorl register. puoa output pwmu phase output (positive phase) puob output pwmu phase output (negative phase) pvoa output pwmv phase output (positive phase) pvob output pwmv phase output (negative phase) pwoa output pwmw phase output (positive phase) pwob output pwmw phase output (negative phase)
rev. 2.00, 09/04, page 486 of 720 16.3 register descriptions the mmt has the following registers. for details on register addresses and the register states during each processing, refer to appendix a, internal i/o register. ? timer mode register (mmt_tmdr*) ? timer control register (tcnr) ? timer status register (mmt_tsr*) ? timer counter (mmt_tcnt*) ? timer buffer register u (tbru) ? timer buffer register v (tbrv) ? timer buffer register w (tbrw) ? timer general register uu (tgruu) ? timer general register vu (tgrvu) ? timer general register wu (tgrwu) ? timer general register u (tgru) ? timer general register v (tgrv) ? timer general register w (tgrw) ? timer general register ud (tgrud) ? timer general register vd (tgrvd) ? timer general register wd (tgrwd) ? timer dead time counter 0 (tdcnt0) ? timer dead time counter 1 (tdcnt1) ? timer dead time counter 2 (tdcnt2) ? timer dead time counter 3 (tdcnt3) ? timer dead time counter 4 (tdcnt4) ? timer dead time counter 5 (tdcnt5) ? timer dead time data register (mmt_tddr*) ? timer period buffer register (tpbr) ? timer period data register (tpdr) note: * in this section, the names of these re gisters are further abbreviated to tmdr, tsr, tcnt, and tddr hereafter.
rev. 2.00, 09/04, page 487 of 720 16.3.1 timer mode register (mmt_tmdr) the timer mode register (mmt_tmdr) sets th e operating mode and selects the pwm output level. in this section, the name of this register is abbreviated to tmdr hereafter. bit bit name initial value r/w description 7 ? 0 r reserved these bits are always read as 0 and should only be written with 0. 6 5 4 cks2 cks1 cks0 0 0 0 r/w r/w r/w clock select 2 to 0 selects the clock input to mmt. 000: p 001: p /4 010: p /16 011: p /64 100: p /256 101: p /1024 11x: setting prohibited. note: x ?don't care?. 3 olsn 0 r/w output level select n selects the negative phase ou tput level in the operating modes. 0: active level is low 1: active level is high 2 olsp 0 r/w output level select p selects the positive phase output level in the operating modes. 0: active level is low 1: active level is high 1 0 md1 md0 0 0 r/w r/w mode 0 to 3 these bits set the timer operating mode. 00: operation halted 01: operating mode 1 (tr ansfer at tcnt = tpdr) 10: operating mode 2 (tr ansfer at tcnt = tddr 2) 11: operating mode 3 (trans fer at tcnt = tpdr or tcnt = tddr 2)
rev. 2.00, 09/04, page 488 of 720 16.3.2 timer control register (tcnr) the timer control register (tcnr) controls the enabling or disabling of interrupt requests, selects the enabling or disablin g of register access, and selects counter operation or halting. bit bit name initial value r/w description 7 ttge 0 r/w a/d start-conversion request enable enables or disables the generation of a/d start-conversion requests when the tgfn or tg fm bit of the timer status register (tsr) is set. 0: disable request 1: enable request 6 cst 0 r/w timer counter start selects operation or halting of the timer counter (tcnt) and timer dead time counter (tdcnt). 0: tcnt and tdcnt operation is halted 1: tcnt and tdcnt perfo rm count operations 5 rpro 0 r/w register protects enables or disables the read ing of registers other than tsr, and enables or disables t he writing to registers other than tbru to tbrw, tpbr, and tsr. writes to tcnr itself are also disabled. note that reset input is necessary in order to write to these registers again. 0: register access enabled 1: register access disabled 4 to 2 ? all 0 r reserved these bits are always read as 0. only 0 should be written to these bits. 1 tgien 0 r/w tgr interrupt enable n enables or disables interrupt requests by the tgfn bit when tgfn is set to 1 in the tsr register. 0: interrupt requests by tgfn bit disabled 1: interrupt requests by tgfn bit enabled 0 tgiem 0 r/w tgr interrupt enable m enables or disables interrupt requests by the tgfm bit when tgfm is set to 1 in the tsr register. 0: interrupt requests by tgfm bit disabled 1: interrupt requests by tgfm bit enabled
rev. 2.00, 09/04, page 489 of 720 16.3.3 timer status register (mmt_tsr) the timer status register (mmt_tsr) holds status flags. (in this section, the name of this register is abbreviated to tsr hereafter.) bit bit name initial value r/w description 7 tcfd 1 r count direction flag status flag that indicates the count direction of the tcnt counter. 0: tcnt counts down 1: tcnt counts up 6 to 2 ? all 0 r reserved these bits are always read as 0 and should only be written with 0. 1 tgfn 0 r/(w) * output compare flag n status flag that indicates a compare match between tcnt and 2td (td: tddr value). [setting condition] ? when tcnt = 2td [clearing condition] ? when 0 is written to tgfn after reading tgfn = 1 0 tgfm 0 r/(w) * output compare flag m status flag that indicates a compare match between tcnt and the tpdr register. [setting condition] ? when tcnt = tpdr [clearing condition] ? when 0 is written to tgfm after reading tgfm = 1 note: * can only be written with 0 for flag clearing.
rev. 2.00, 09/04, page 490 of 720 16.3.4 timer coun ter (mmt_tcnt) the timer counter (mmt_tcnt) is a 16-bit counter. the initial value is h'0000. only 16-bit access can be used on mmt_tcnt; 8-bit access is not possible. (in this secti on, the name of this register is abbreviated to tcnt hereafter.) 16.3.5 timer buffer registers (tbr) the timer buffer registers (tbr) function as 16-bit buffer registers. the mmt has three tbr registers; tbru, tbrv, and tbrw, each of which has two addresses; a buffer operation address (shown first) and a free operation address (shown se cond). a value written to the buffer operation address is transferred to the co rresponding tgr at the timing set in bits md1 and md0 in the timer mode register (tmdr). a value set in th e free operation address is transferred to the corresponding tgr immediately. the initial valu e of tbr is h'ffff. on ly 16-bit access can be used on the tbr registers; 8-bit access is not possible. 16.3.6 timer general registers (tgr) the timer general registers (tgr) function as 16-bit compare registers. the mmt has nine tgr registers, that are compared with the tcnt counter in the operat ing modes. the initial value of tgr is h'ffff. only 16-bit access can be used on the tgr registers; 8-bi t access is not possible. 16.3.7 timer dead time counters (tdcnt) the timer dead time counters (tdcnt) are 16-bit read-only counters. the initial value of tdcnt is h'0000. only 16-bit access can be used on th e tdcnt counters; 8-bit access is not possible. 16.3.8 timer dead time data register (mmt_tddr) the timer dead time data register (mmt_tddr) is a 16-bit register that sets the positive phase and negative phase non-overlap time (dead time). the initial value of mmt_tddr is h'ffff. only 16-bit access can be used on mmt_tddr; 8-bit access is not possible. (in this section, the name of this register is further abbreviated to tddr hereafter.) 16.3.9 timer period bu ffer register (tpbr) the timer period buffer register (tpbr) is a 16-bit register that functions as a buffer register for the tpdr register. a value of 1/2 the pwm carrier period should be set as the tpbr value. the tpbr value is transferred to the tpdr register at the transfer timing set in the tmdr register. the initial value of tpbr is h'ffff. only 16-bit access can be used on tpbr; 8-bit access is not possible.
rev. 2.00, 09/04, page 491 of 720 16.3.10 timer period data register (tpdr) the timer period data register (tpdr) functions as a 16-bit compare register. in the operating modes, the tpdr register value is constantly compared with the tcnt counter value, and when they match the tcnt counter changes its count di rection from up to down. the initial value of tpdr is h'ffff. only 16-bit access can be used on tpdr; 8-bit access is not possible. 16.4 operation when the operating mode is selected, a 3-phase pwm waveform is output with a non-overlap relationship between the positive and negative phases. the puoa, puob, pvoa, pvob, pwoa, and pwob pins are pwm output pins, the pcio pin (when set to output) functions as a toggle output synchronized with the pwm waveform, and the pci0 pin (when set to input) functions as the counter clear signal input. the tcnt counter performs up- and down-count operations, whereas the tdcnt counters perform up-count operations.
rev. 2.00, 09/04, page 492 of 720 16.4.1 sample setting procedure an example of the operating mode setting procedure is shown in figure 16.2. halt count operation set tcnt set tbr set pwm output level set operating mode set external pin functions start count operation set dead time carrier period clear the cst bit to 0 in the timer control register (tcnr) to halt timer counter operation. make the operating mode setting while tcnt is halted. set 2td (td: dead time) in tcnt. set the output pwm duty cycle {pwm duty cycle initial value ? td} in the free operation addresses of the buffer registers (tbru, tbrv, tbrw). set dead time td in the dead time data register (tddr), set 1/2 the carrier period in the timer period buffer register (tpbr), and set {tpbr value + 2td} in the timer period data register (tpdr). set the pwm output level with bits olsn and olsp in the timer mode register (tmdr). set the operating mode in the timer mode register (tmdr). the puoa, puob, pvoa, pvob, pwoa, and pwob pins are output pins. set the external pin functions with the pin function controller (pfc). set the cst bit to 1 in tcnr to start the count operation. figure 16.2 sample operating mode setting procedure
rev. 2.00, 09/04, page 493 of 720 count operation: set 2td (td: value set in tddr) as the initial value of the tcnt counter when cst bit in tcnr is set to 0. when the cst bit is set to 1, tcnt counts up to {value set in tpbr + 2td}, and then starts counting down. when tcnt reaches 2td, it starts counting up agai n, and continues in this way. tcnt is constantly compared with tgru, tgrv, and tgrw. in addition, it is compared with tgruu, tgrvu, tgrwu, and tpdr when counting up, and with tgrud, tgrvd, tgrwd, and 2td when counting down. tdcnt0 to tdcnt5 are read-only counters. it is not necessary to set their initial values. tdcnt0, tdcnt2, and tdcnt4 start counting up at the falling edge of a positive phase compare match output when tcnt is counting down. when they become equal to tddr they are cleared to 0 and halt. tdcnt1, tdcnt3, and tdcnt5 start counting up at the falling edge of a negative phase compare match output when tcnt is counting up. when they match tddr they are cleared to 0 and halt. tdcnt0 to tdcnt5 are compared with tddr only while a count operati on is in progress. no count operation is performed when the tddr value is 0. figure 16.3 shows an example of the tcnt count operation. tcnt td h'ffff h'0000 tpdr tgruu tgru tgrud 2td td td 2td 2td 1/2 period (tpbr) figure 16.3 example of tcnt count operation
rev. 2.00, 09/04, page 494 of 720 register operation: in the operating modes, four buffer registers and ten compare registers are used. the registers that are constantly compared with the tcnt counter are tgru, tgrv, and tgrw. in addition, tgruu, tgrvu, tgrwu, and tpdr are compared with tcnt when tcnt is counting up, and tgrud, tgrvd, tgrwd are compared with tcnt when tcnt is counting down. the buffer register for tpdr is tpbr; the buffer register for tgruu, tgru, and tgrud is tbru; the buffer register for tgrvu, tgrv, and tgrv d is tbrv; and the buffer register for tgrwu, tgrw, and tgrwd is tbrw. to change compare register data, the new data should be written to the corresponding buffer register. the buffer registers can be read and written to at all ti mes. data written to the buffer operation addresses for tpbr and tbru to tbrw is transferred at the timing specified by bits md1 and md0 in the timer mode register (tmdr). data written to the free operation addresses for tbru to tbrw is transferred immediately. after data transfer is completed, the relatio nship between the compare registers and buffer registers is as follows: tgru (tgrv, tgrw) value = tbru (tbrv, tbrw) value + td (td: value set in tddr) tgruu (tgrvu, tgrwu) value = tbru (tbrv, tbrw) value + 2td tgrud (tgrvd, tgrwd) value = tbru (tbrv, tbrw) value tpdr value = tpbr value + 2td the values of tbru to tbrw should always be set in the range h'0000 to h'ffff ? 2td, and the value of tpbr should always be set in the range h'0000 to h'ffff ? 4td. figure 16.4 shows examples of counter and register operations.
rev. 2.00, 09/04, page 495 of 720 + + + compared during up-count compared during down-count compared during up-count compared during down-count up-count compare match down-count down-count compare match up-count constantly compared (tbr + 2td) (tbr + td) (tbr) tgruu tgrvu tgrwu tgru tgrv tgrw tgrud tgrvd tgrwd tpdr tcnt (1/2 period + 2td) tddr (td) tpbr (1/2 period) tddr tddr tdcnt (td) (td) tbru tbrv tbrw (tbr) (2td) 2 2 up-count compare match halt tcnt figure 16.4 examples of co unter and register operations initial settings: in the operating modes, there are five registers that require initialization. make the following register settings before setting the operating mode with bits md1 and md0 in the timer mode register (tmdr). set the timer period buffer register (tpbr) to 1/2 the pwm carrier period, set dead time td in the timer dead time data register (tddr) (when outputting an ideal waveform, td = h'0000), and set {tpbr value + 2td} in the timer period data register (tpdr). set {pwm duty initial value ? td} in the free write operation addresses for tbru to tbrw. the values of tbru to tbrw should always be set in the range h'0000 to h'ffff ? 2td, and the value of tpbr should always be set in the range h'0000 to h'ffff ? 4td.
rev. 2.00, 09/04, page 496 of 720 pwm output active level setting: in the operating modes, the active level of pwm pulses is set with bits olsn and olsp in the timer mode register (tmdr). the output level can be set for the three positive phases and the three nega tive phases of 6-phase output. the operating mode must be exited before setting or changing the output level. dead time setting: in the operating modes, pwm pulses are output with a non-overlap relationship between the positive and negative phases . this non-overlap time is known as the dead time. the non-overlap time is set in the timer dead time data register (tddr). the dead time generation waveform is generated by comparing the value set in tddr with the timer dead time counters (tdcnt) for each phase. the operating mode must be exited before changing the contents of tddr. pwm period setting: in the operating modes, 1/2 the pwm pulse period is set in the tpbr register. the tpbr value should always be set in the range h'0000 to h'ffff ? 4td. the value set in tpbr is transferred to tpdr at the timing selected with bits md1 and md0 in the timer mode register (tmdr). after the transfer, the value in tpdr is {tpbr value + 2td}. the new pwm period is effective from the next period when data is updated at the tcnt counter crest, and from the same period when data is updated at the trough. register updating: in the operating modes, buffer register s are used to update compare register data. update data can be written to a buffer regist er at all times. the bu ffer register value is transferred to the compare regist er at the timing set by bits md1 and md0 in the timer mode register (tmdr) (except in the case of a write to the free operation addr ess for tbru to tbrw, in which case the value is tran sferred to the corresponding co mpare register immediately). initial output in operating modes: the initial output in the operating modes is determined by the initial values of tbru to tbrw. table 16.2 shows the relationship between the initial value of tbru to tbrw and the initial output. table 16.2 initial values of tbru to tbrw and initial output initial output initial value of tbru to tbrw olsp = 1, olsn = 1 olsp = 0, olsn = 0 tbr = h'0000 positive phase: 1 negative phase: 0 positive phase: 0 negative phase: 1 h'0000 < tbr td positive phase: 0 negative phase: 0 positive phase: 1 negative phase: 1 td < tbr h'ffff ? 2td positive phase: 0 negative phase: 1 positive phase: 1 negative phase: 0
rev. 2.00, 09/04, page 497 of 720 pwm output generation in operating modes: in the operating modes, a 3-phase pwm waveform is output with a non-overlap relationshi p between the positive and negative phases. this non-overlap time is called the dead time. the pwm waveform is generated from an output generation waveform generated by anding the compare output waveform with the dead time ge neration waveform. waveform generation for one phase (the u-phase) is shown here. the v-phase and w-phase waveforms are generated in the same way. 1. compare output waveform the compare output waveform is generated by comparing the values in the tcnt counter and the tgr registers. for compare output waveform u phase a (cmoua), 0 is output if tgruu > tcnt in the t1 interval (when tcnt is counting up), and 1 is output if tgruu tcnt. in the t2 interval (when tcnt is counting down), 0 is output if tgru > tcnt, and 1 is output if tgru tcnt. for compare output waveform u phase b (cmoub), 1 is output if tgru > tcnt in the t1 interval, and 0 is output if tgru tcnt. in the t2 interval, 1 is output if tgrud > tcnt, and 0 is output if tgrud tcnt. 2. dead time generation waveform for dead time generation waveform u phases a (dtgua) and b (dtgub), 1 is output as the initial value. tdcnt0 starts counting at the falling edge of cmoua. dtgua outputs 0 if tdcnt0 is counting, and 1 otherwise. tdcnt1 starts counting at the falling edge of cmoub. dtgub outputs 0 if tdcnt1 is counting, and 1 otherwise. 3. output generation waveform output generation waveform u phase a (ogua) is generated by anding cmoua and dtgub, and output generation waveform u phase b (ogub) is generated by anding cmoub and dtgua. 4. pwm waveform the pwm waveform is generated by converting the output generation waveform to the output level set in bits olsn and olsp in the timer mode register (tmdr). figure 16.5 shows an example of pwm waveform generation (operating mode 3, olsn = 1, olsp = 1).
rev. 2.00, 09/04, page 498 of 720 when writing to free operation address tpdr 2td compare output waveform dead time generation waveform output generation waveform pwm waveform figure 16.5 example of pwm waveform generation 0% to 100% duty cycle output: in the operating modes, pwm waveforms with any duty cycle from 0% to 100% can be output. the output pwm duty cycle is set using the buffer registers (tbru to tbrw). 100% duty cycle output is performed when the buffer register (tbru to tbrw) value is set to h'0000. the waveform in this case has positive phase in the 100% on state. 0% duty cycle output is performed when a value greater than the tpdr value is set as the buff er register (tbru to tbrw) value. the waveform in this case has positive phase in the 100% off state. external counter clear function: in the operating modes, the tcnt counter can be cleared from an external source. when using the counter clearing function, port a i/o register l (paiorl) should be used to set the pcio pin as an input. on the falling edge of pcio pin (when set to input), the tcnt counter is reset to 2td (the initial setting). it then counts up until it reaches the valu e in tpdr, then starts counting down. when the count returns to 2td, tcnt starts counting up again, and this sequence is repeated. figure 16.6 shows the example for counter clearing.
rev. 2.00, 09/04, page 499 of 720 tcnt tpdr 2td h'0000 pcio (counter clear input) figure 16.6 example of tcnt counter clearing toggle output synchronized with pwm cycle: in the operating modes, output can be toggled synchronously with the pwm carri er cycle. when outputting the pwm cycle, the pin function controller (pfc) should be used to set the pcio pin as an output(when set to output). an example of the toggle output waveform is shown in figure 16.7. pwm cycle output is toggled according to the tc nt count direction. the toggle output pin is pcio (when set to output). pcio outputs 1 when tcnt is counting up, and 0 when counting down. tcnt tpdr 2td h'0000 pcio pin (toggle output) figure 16.7 example of toggle output waveform synchronized with pwm cycle settings for a/d start-conversion requests: requests to start a/d conversion can be set up to be issued when tcnt matches tpdr or 2td. when the start requests are set up for issue when tcnt matches tpdr, a/d conversion will start at the center of the pwm pulse (the peak value of the tcnt counter). when the start requests are set up for is sue when tcnt matches 2td, a/d conversion will start on the edge of the pwm pulse (the minimum value of the tcnt counter).
rev. 2.00, 09/04, page 500 of 720 requests to start a/d conversion is enabled by se tting the bit ttge in the timer control register (tcnr) to 1. table 16.3 shows the relationship between a/d conversion start timing and operating mode. table 16.3 relationship between a/d conv ersion start timing and operating mode operating mode a/d conversion start timing operating mode 1 (transfer at peak ) a/d conversion start at bottom operating mode 2 (transfer at bo ttom) a/d conversion start at peak operating mode 3 (transfer at peak and bo ttom) a/d conversion start at peak and bottom 16.4.2 output protection functions operating mode output has the following protection functions: ? halting mmt output by external signal the 6-phase pwm output pins can be placed in the high-impedance state automatically by inputting a specified external signal. there are th ree external signal input pins. for details, see section 16.8, port output enable (poe). ? halting mmt output when oscillation stops the 6-phase pwm output pins are placed in th e high-impedance state automatically when stoppage of the clock input is detected. however, pin states are not guaranteed when the clock is restarted. 16.5 interrupts when the tgfm (tgfn) flag is set to 1 in the timer status register (t sr) by a compare match between tcnt and the tpdr register (2td), and if the tgiem (tgien) bit setting in the timer control register (tcnr) is 1, an interrupt is re quested. the interrupt reques t is cleared by clearing the tgf flag to 0. table 16.4 mmt interrupt sources name interrupt source interrupt flag dtc activation tgimn compare match between tcnt and tpdr tgfm yes tginn compare match betwe en tcnt and 2td tgfn yes the on-chip dtc can be activated by a compar e match between tcnt and tpdr or between tcnt and 2td.
rev. 2.00, 09/04, page 501 of 720 the on-chip a/d converter can be activated when tcnt matches tpdr or 2td. when the tgf flag in the timer status register (tsr) is set to 1 as a result of either matc h corresponding, a request to start a/d conversion is sent to the a/d convert er. if the start-conversi on trigger of the mmt is selected in the a/d converter at th at time, a/d conversion starts up. 16.6 operation timing 16.6.1 input/output timing tcnt and tdcnt count timing: figure 16.8 shows the tcnt and tdcnt count timing. n ? 3 n ? 2 n ? 1 n n + 1 n + 2 n + 3 n + 4 p tcnt, tdcnt figure 16.8 count timing tcnt counter clearing timing: figure 16.9 shows the timing of tcnt counter clearing by an external signal. n ? 3 n ? 2 n ? 1 n n + 1 2td 2td + 1 2td + 2 td p tcnt counter clear signal tddr figure 16.9 tcnt co unter clearing timing
rev. 2.00, 09/04, page 502 of 720 tdcnt operation timing: figure 16.10 shows the tdcnt operation timing. h'0001 . . . . td ? 1 td h'0000 h'0000 td cmo p tdcnt tddr compare match signal tdcnt clear signal dtg notes: cmo: compare match flag of tgr + tddr and tcnt dtg: operation signal of tdcnt figure 16.10 tdcnt operation timing
rev. 2.00, 09/04, page 503 of 720 buffer operation timing: figure 16.11 shows the compare match buffer operation timing. m1 m2 m0 td p tpbr tddr l0 + 2td l2 + 2td l1 + 2td tgruu, tgrvu, tgrwu l0 + td l2 + td l1 + td tgru, tgrv, tgrw l0 l2 l1 tgrud, tgrvd, tgrwd l1 l2 l0 tbru, tbrv, tbrw m1 + 2td m2 + 2td m0 + 2td tpdr n ? 1 . . . . n ? 1 n 2td + 1 2td 2td + 1 2td + 2 tcnt compare match signal figure 16.11 buffer operation timing
rev. 2.00, 09/04, page 504 of 720 16.6.2 interrupt signal timing timing of tgf flag setting by compare match: figure 16.12 shows the timing of setting of the tgf flag in the timer status register (t sr) on a compare match between tcnt and tpdr, and the timing of the tgi interrupt request signa l. the timing is the same for a compare match between tcnt and 2td. n tpdr n ? 3 n ? 2 n ? 1 n n + 1 n + 2 n + 3 n + 4 tcnt compare match signal tgf flag tgi interrupt p figure 16.12 tgi interrupt timing status flag clearing timing: a status flag is cleared when th e cpu reads 1 from the flag, then 0 is written to it. when the dtc controller is activated, the flag is cleared automatically. figure 16.13 shows the timing of status flag clearing by the cpu, and figure 16.14 shows the timing of status flag clearing by the dtc. tsr address p address interrupt request signal status flag write signal t1 t2 tsr write cycle figure 16.13 timing of status flag clearing by cpu
rev. 2.00, 09/04, page 505 of 720 source address p address interrupt request signal status flag destination address t1 t2 dtc read cycle dtc write cycle t1 t2 figure 16.14 timing of status flag clearing by dtc controller 16.7 usage notes 16.7.1 module standby mode setting mmt operation can be disabled or enabled using the module standby control register. the initial setting is for mmt operation to be halted. regist er access is enabled by clearing module standby mode. for details, refer to section 24, power-down modes. 16.7.2 notes for mmt operation note that the kinds of operation and contention described below occur during mmt operation. contention between buffer regi ster write and compare match: if a compare match occurs in the t2 state of a buffer register (tbru to tbrw, or tpbr) write cycle, data is transferred from the buffer register to the compare register (t gr or tpdr) by a buffer operation. the data transferred is the buffer register write data. figure 16.15 shows the timing in this case.
rev. 2.00, 09/04, page 506 of 720 buffer register write data n m m p address compare match signal interrupt request signal buffer register compare register write signal buffer register address t1 t2 buffer register write cycle figure 16.15 contention between bu ffer register write and compare match contention between compare register write and compare match: if a compare match occurs in the t2 state of a compare register (t gr or tpdr) write cycle, the compare register write is not performed, and data is transferred from the buffer register (tbru, tbrv, tbrw, or tpbr) to the compare regist er by a buffer operation. figure 16.16 shows the timing in this case.
rev. 2.00, 09/04, page 507 of 720 n n p address compare match signal interrupt request signal buffer register compare register write signal compare register address compare register write cycle t1 t2 figure 16.16 contention between co mpare register write and compare match pay attention to the notices below, when a value is written into the timer general register u (tgru), timer general regist er v (tgrv), timer general register w (tgrw), and in case of written into free operation address (*): ? in case of counting up: do not write a value {previous value of tgru + td} into tgru. ? in case of counting down: do not write a value { previous value of tgru - td} into tgru. in the same manner to tgrv and tgrw. when a value {previous value of tgru + td} is written (in case of counting down {previous value of tgru - td}), the output of puoa/puob, pvoa/pvob, pwoa/pwob (corresponding to u, v, w phase) may not be output for 1 cycle. figure 16.17 shows the er ror case. when writing in to the buffer operation address, these notes are not relevant. note: * when addresses, h'ffff8a1c, h'fff f8a2c, h'ffff8a3c are used as register address for tbru, tbrv , tbrw, respectively.
rev. 2.00, 09/04, page 508 of 720 tgru tgru previoustgru previoustgru td td 2td 2td count-up count down figure 16.17 writing into timer general registers (when one cycle is not output) writing operation into timer period data register (tpdr) and timer dead time data register (tddr) when mmt is operating: ? do not revise tpdr register when mmt is operating. always use a buffer-write operation through tpbr register. ? do not revise tddr register once an operation of mmt is invoked. when tddr is revised, a wave may not be output for as much as 1 cycle (full count period of 16 bits in tdcnt), because a value cannot be written into tdcnt, which is compared to a value set in tddr. 16.8 port output enable (poe) the port output enable (poe) circuit enables the mmt's output pins (poua, poub, pova, povb, powa, and powb) to be pl aced in the high-impedance state by varying the input to pins poe4 to poe6 . an interrupt can also be requested at the same time. in addition, the mmt's output pins will also enter the high-impedance state in standby mode or when the oscillator halts. 16.8.1 features the poe circuit has the following features: ? falling edge, p /8 16 times, p /16 16 times, or p /128 16 times low-level sampling can be set for each of input pins poe4 to poe6 . ? the mmt's output pins can be pl aced in the high-impedance stat e at the falling edge or low- level sampling of pins poe4 to poe6 . ? an interrupt can be generated by input level sampling.
rev. 2.00, 09/04, page 509 of 720 p /8 poe6 poe5 poe4 p /16 falling edge detection circuit low level detection circuit icsr2 input level detection circuit p /128 high impedance request control signal interrupt request (mmtpoe) figure 16.18 block diagram of poe 16.8.2 input/output pins table16.5 shows the pin configuration of the poe circuit. table 16.5 pin configuration name abbreviation i/o function port output enable input pins poe4 to poe6 input input request signals for placing mmt's output pins in high-impedance state 16.8.3 register descriptions the poe circuit has the following registers. ? input level control/status register (icsr2) input level control/status register (icsr2): the input level control/status register (icsr2) is a 16-bit readable/writable register that selects the input mode for pins poe4 to poe6 , controls enabling or disabling of interrupts, and holds status information.
rev. 2.00, 09/04, page 510 of 720 bit bit name initial value r/w description 15 ? 0 r reserved this bit is always read as 0 and should only be written with 0. 14 poe6f 0 r/(w) * poe6 flag indicates that a high impedance request has been input to the poe6 pin. [clearing condition] ? when 0 is written to poe6f after reading poe6f = 1 [setting condition] ? when the input set by bits 4 and 5 of icsr2 occurs at the poe6 pin 13 poe5f 0 r/(w) * poe5 flag indicates that a high impedance request has been input to the poe5 pin. [clearing condition] ? when 0 is written to poe5f after reading poe5f = 1 [setting condition] ? when the input set by bits 2 and 3 of icsr2 occurs at the poe5 pin 12 poe4f 0 r/(w) * poe4 flag indicates that a high impedance request has been input to the poe4 pin. [clearing condition] ? when 0 is written to poe4f after reading poe4f = 1 [setting condition] ? when the input set by bits 0 and 1 of icsr2 occurs at the poe4 pin 11 to 9 ? all 0 r reserved these bits are always read as 0 and should only be written with 0. 8 pie 0 r/w port interrupt enable enables or disables an interrupt request when 1 is set in any of bits poe4f to poe6f in icsr2. 0: interrupt request disabled 1: interrupt request enabled
rev. 2.00, 09/04, page 511 of 720 bit bit name initial value r/w description 7, 6 ? all 0 r reserved these bits are always read as 0 and should only be written with 0. 5 4 poe6m1 poe6m0 0 0 r/w r/w poe6 mode 1 and 0 these bits select the input mode of the poe6 pin. 00: request accepted at falling edge of poe6 input 01: poe6 input is sampled for low level 16 times every p /8 clock, and request is accepted when all samples are low level 10: poe6 input is sampled for low level 16 times every p /16 clock, and request is accepted when all samples are low level 11: poe6 input is sampled for low level 16 times every p /128 clock, and request is accepted when all samples are low level 3 2 poe5m1 poe5m0 0 0 r/w r/w poe5 mode 1 and 0 these bits select the input mode of the poe5 pin. 00: request accepted at falling edge of poe5 input 01: poe5 input is sampled for low level 16 times every p /8 clock, and request is accepted when all samples are low level 10: poe5 input is sampled for low level 16 times every p /16 clock, and request is accepted when all samples are low level 11: poe5 input is sampled for low level 16 times every p /128 clock, and request is accepted when all samples are low level 1 0 poe4m1 poe4m0 0 0 r/w r/w poe4 mode 1 and 0 these bits select the input mode of the poe4 pin. 00: request accepted at falling edge of poe4 input 01: poe4 input is sampled for low level 16 times every p /8 clock, and request is accepted when all samples are low level 10: poe4 input is sampled for low level 16 times every p /16 clock, and request is accepted when all samples are low level 11: poe4 input is sampled for low level 16 times every p /128 clock, and request is accepted when all samples are low level note: * only 0 can be written to clear the flag.
rev. 2.00, 09/04, page 512 of 720 16.8.4 operation input level detection: when the input condition set in icsr2 occurs on any one of the poe pins, the mmt output pins go to the high-impedance state. ? pins placed in the high-impedance state (the mmt's output pins) the six pins pwob, pwoa, pvob, pvoa, puob, puoa in the motor management timer (mmt) are placed in the high-impedance state. note: these pins are in the hi gh-impedance state only when each pin is used as the general input/output function or mmt output pin. 1. falling edge detection when a transition from high- to low-level input occurs on a poe pin 2. low level detection figure 16.19 shows the low level detection operation. low level sampling is performed 16 times in succession using the sampling clock set in icsr2. the input is not accepted if a high level is detected even once among these samples. the timing of entry of the mmt's output pins into the high-impedance state from the sampling clock is the same for falling edge detection and low level detection. p 8, 16, or 128 clocks sampling clock poe input puoa all low-level samples at least one high-level sample [1] [1] [2] [2] [3] [16] flag set (poe accepted) high-impedance state flag not set [13] note: the other mmt output pins also go to the high-impedance state at the same timing. figure 16.19 low leve l detection operation exiting high-impedance state: the mmt output pins that have entered the high-impedance state by the input level detection are released from this state by restoring them to their initial states by means of a power-on reset, or by clearing all the poe flags in icsr2 (poe4f to poe6f: bits 12 to 14).
rev. 2.00, 09/04, page 513 of 720 16.8.5 usage note 1. to set the poe pin as a level-detective pin, a high level signal must be firstly input to the poe pin. 2. to clear bits poe4f, poe5f, and poe6f to 0, read the icsr2 register. clear bits, which are read as 1, to 0, and write 1 to the other bits in the register.
rev. 2.00, 09/04, page 514 of 720
rev. 2.00, 09/04, page 515 of 720 section 17 pin function controller (pfc) the pin function controller (pfc) is composed of those registers that are used to select the functions of multiplexed pins and assign pins to be inputs or outputs. tables 17.1 to 17.5 list the multiplexed pins. tables 17.6 and 17.7 list the pin functions in each operating mode. table 17.1 multiplexed pins (port a) port function 1 (related module) function 2 (related module) function 3 (related module) function 4 (related module) function 5 (related module) function 6 (related module) function 7 (related module) function 8 (related module) a pa0 i/o (port) ? ? ? a0 output (bsc) poe0 input (port) rxd2 input (sci) ? pa1 i/o (port) ? ? ? a1 output (bsc) poe1 input (port) txd2 output (sci) ? pa2 i/o (port) ? ? irq0 input (intc) a2 output (bsc) pcio i/o (mmt) sck2 i/o (sci) ? pa3 i/o (port) ? ? ? a3 output (bsc) poe4 input (port) rxd3 input (sci) ? pa4 i/o (port) ? ? ? a4 output (bsc) poe5 input (port) txd3 output (sci) ? pa5 i/o (port) ? ? irq1 input (intc) a5 output (bsc) poe6 input (port) sck3 i/o (sci) ? pa6 i/o (port) tclka input (mtu) ? rd output (bsc) ? rxd2 input (sci) ? ? pa7 i/o (port) tclkb input (mtu) ? wait input (bsc) ? txd2 output (sci) ? ? pa8 i/o (port) tclkc input (mtu) irq2 input (intc) ? ? rxd3 input (sci) ? ? pa9 i/o (port) tclkd input (mtu) irq3 input (intc) ? ? txd3 output (sci) ? ? pa10 i/o (port) cs0 output (bsc) rd output (bsc) ? tck input (h-udi) * sck2 i/o (sci) ? ? pa11 i/o (port) ? adtrg input (a/d) ? ? sck3 i/o (sci) ? ? pa12 i/o (port) wrl output (bsc) ubctrg output (ubc) * ? tdi input (h-udi) * ? ? ? pa13 i/o (port) ? poe4 input (port) ? tdo output (h-udi) * breq input (bsc) ? ? pa14 i/o (port) rd output (bsc) poe5 input (port) ? tms input (h-udi) * ? ? ? pa15 i/o (port) ck output (cpg) poe6 input (port) ? trst input (h-udi) * back output (bsc) ? ? note: * f-ztat only
rev. 2.00, 09/04, page 516 of 720 table 17.2 multiplexed pins (port b) port function 1 (related module) function 2 (related module) function 3 (related module) function 4 (related module) function 5 (related module) function 6 (related module) function 7 (related module) function 8 (related module) b pb0 i/o (port) a16 output (bsc) ? htxd1 output (hcan2) ? ? ? ? pb1 i/o (port) a17 output (bsc) ? hrxd1 input (hcan2) ? ? ? sck4 i/o (sci) pb2 i/o (port) irq0 input (intc) poe0 input (port) ? ? ? ? rxd4 input (sci) pb3 i/o (port) irq1 input (intc) poe1 input (port) ? ? ? ? txd4 output (sci) pb4 i/o (port) irq2 input (intc) poe2 input (port) ? ? ? ? sck4 i/o (sci) pb5 i/o (port) irq3 input (intc) poe3 input (port) ? ? ck output (cpg) ? ? table 17.3 multiplexed pins (port d) port function 1 (related module) function 2 (related module) function 3 (related module) function 4 (related module) d pd0 i/o (port) d0 i/o (bsc) rxd2 input (sci) audata0 i/o (aud) * pd1 i/o (port) d1 i/o (bsc) txd2 output (sci) audata1 i/o (aud) * pd2 i/o (port) d2 i/o (bsc) sck2 i/o (sci) audata2 i/o (aud) * pd3 i/o (port) d3 i/o (bsc) ? audata3 i/o (aud) * pd4 i/o (port) d4 i/o (bsc) ? audrst input (aud) * pd5 i/o (port) d5 i/o (bsc) ? audmd input (aud) * pd6 i/o (port) d6 i/o (bsc) ? audck i/o (aud) * pd7 i/o (port) d7 i/o (bsc) ? audsync i/o (aud) * pd8 i/o (port) ? ? ubctrg output (ubc) * note: * f-ztat only
rev. 2.00, 09/04, page 517 of 720 table 17.4 sh7047 multiplexed pins (port e) port function 1 (related module) function 2 (related module) function 3 (related module) function 4 (related module) e pe0 i/o (port) tioc0a i/o (mtu) ? cs0 output (bsc) pe1 i/o (port) tioc0b i/o (mtu) ? ? pe2 i/o (port) tioc0c i/o (mtu) ? ? pe3 i/o (port) tioc0d i/o (mtu) ? ? pe4 i/o (port) tioc1a i/o (mtu) rxd3 input (sci) a6 output (bsc) pe5 i/o (port) tioc1b i/o (mtu) txd3 output (sci) a7 output (bsc) pe6 i/o (port) tioc2a i/o (mtu) sck3 i/o (sci) a8 output (bsc) pe7 i/o (port) tioc2b i/o (mtu) rxd2 input (sci) a9 output (bsc) pe8 i/o (port) tioc3a i/o (mtu) sck2 i/o (sci) ? pe9 i/o (port) tioc3b i/o (mtu) ? ? pe10 i/o (port) tioc3c i/o (mtu) txd2 output (sci) wrl output (bsc) pe11 i/o (port) tioc3d i/o (mtu) ? ? pe12 i/o (port) tioc4a i/o (mtu) ? ? pe13 i/o (port) tioc4b i/o (mtu) mres input (intc) ? pe14 i/o (port) tioc4c i/o (mtu) ? ? pe15 i/o (port) tioc4d i/o (mtu) ? irqout output (intc) pe16 i/o (port) puoa output (mmt) ubctrg output (ubc) * a10 output (bsc) pe17 i/o (port) pvoa output (mmt) wait input (bsc) a11 output (bsc) pe18 i/o (port) pwoa output (mmt) ? a12 output (bsc) pe19 i/o (port) puob output (mmt) rxd4 input (sci) a13 output (bsc) pe20 i/o (port) pvob output (mmt) tx d4 output (sci) a14 output (bsc) pe21 i/o (port) pwob output (mmt) sck4 i/o (sci) a15 output (bsc) note: * f-ztat only
rev. 2.00, 09/04, page 518 of 720 table 17.5 multiplexed pins (port f) port function 1 (related module) function 2 (related module) function 3 (related module) function 4 (related module) f pf0 input (port) an0 input (a/d-0) ? ? pf1 input (port) an1 input (a/d-0) ? ? pf2 input (port) an2 input (a/d-0) ? ? pf3 input (port) an3 input (a/d-0) ? ? pf4 input (port) an4 input (a/d-1) ? ? pf5 input (port) an5 input (a/d-1) ? ? pf6 input (port) an6 input (a/d-1) ? ? pf7 input (port) an7 input (a/d-1) ? ? pf8 input (port) an8 input (a/d-0) ? ? pf9 input (port) an9 input (a/d-0) ? ? pf10 input (port) an10 input (a/d-0) ? ? pf11 input (port) an11 input (a/d-0) ? ? pf12 input (port) an12 input (a/d-1) ? ? pf13 input (port) an13 input (a/d-1) ? ? pf14 input (port) an14 input (a/d-1) ? ? pf15 input (port) an15 input (a/d-1) ? ?
rev. 2.00, 09/04, page 519 of 720 table 17.6 pin functions in each mode (1) pin name on-chip rom disabled on-chip rom enabled pin no. initial function pfc selected function possibilities initial function pfc selected function possibilities 15, 53, 72, 84 vcc vcc vcc vcc 13, 29, 50, 74, 82 vss vss vss vss 27, 77 vcl vcl vcl vcl 33, 46 avcc avcc avcc avcc 30, 49 avss avss avss avss 1 wdtovf wdtovf wdtovf wdtovf 2 cs0 cs0 pe0 pe0/tioc0a/ cs0 3 pe1 pe1/tioc0b pe1 pe1/tioc0b 4 pe2 pe2/tioc0c pe2 pe2/tioc0c 5 pe3 pe3/tioc0d pe3 pe3/tioc0d 6 a6 a6 pe4 pe4/tioc1a/rxd3/a6 7 a7 a7 pe5 pe5/tioc1b/txd3/a7 8 a8 a8 pe6 pe6/tioc2a/sck3/a8 9 a9 a9 pe7 pe7/tioc2b/rxd2/a9 10 pe8 pe8/tioc3a/sck2 pe8 pe8/tioc3a/sck2 11 asebrkak * asebrkak * asebrkak * asebrkak * 12 pe9 pe9/tioc3b pe9 pe9/tioc3b 14 wrl wrl pe10 pe10/tioc3c/txd2/ wrl 16 dbgmd * dbgmd * dbgmd * dbgmd * 17 pe11 pe11/tioc3d pe11 pe11/tioc3d 18 pe12 pe12/tioc4a pe12 pe12/tioc4a 19 pe13 pe13/tioc4b/ mres pe13 pe13/tioc4b/ mres 20 pe14 pe14/tioc4c pe14 pe14/tioc4c 21 pe15 pe15/tioc4d/ irqout pe15 pe15/tioc4d/ irqout 22 a10 a10 pe16 pe16/puoa/ ubctrg * / a10 23 a11 a11 pe17 pe17/pvoa/ wait /a11 24 a12 a12 pe18 pe18/pwoa/a12 25 a13 a13 pe19 pe19/puob/rxd4/a13 26 a14 a14 pe20 pe20/pvob/txd4/a14 28 a15 a15 pe21 pe21/pwob/sck4/a15
rev. 2.00, 09/04, page 520 of 720 pin name on-chip rom disabled on-chip rom enabled pin no. initial function pfc selected function possibilities initial function pfc selected function possibilities 31 pf7/an7 pf7/an7 pf7/an7 pf7/an7 32 pf15/an15 pf15/an15 pf15/an15 pf15/an15 34 pf6/an6 pf6/an6 pf6/an6 pf6/an6 35 pf14/an14 pf14/an14 pf14/an14 pf14/an14 36 pf5/an5 pf5/an5 pf5/an5 pf5/an5 37 pf13/an13 pf13/an13 pf13/an13 pf13/an13 38 pf4/an4 pf4/an4 pf4/an4 pf4/an4 39 pf12/an12 pf12/an12 pf12/an12 pf12/an12 40 pf11/an11 pf11/an11 pf11/an11 pf11/an11 41 pf3/an3 pf3/an3 pf3/an3 pf3/an3 42 pf10/an10 pf10/an10 pf10/an10 pf10/an10 43 pf2/an2 pf2/an2 pf2/an2 pf2/an2 44 pf9/an9 pf9/an9 pf9/an9 pf9/an9 45 pf1/an1 pf1/an1 pf1/an1 pf1/an1 47 pf8/an8 pf8/an8 pf8/an8 pf8/an8 48 pf0/an0 pf0/an0 pf0/an0 pf0/an0 51 ck pb5/ irq3 / poe3 /ck ck pb5/ irq3 / poe3 /ck 52 pb4 pb4/ irq2 / poe2 /sck4 pb4 pb4/ irq2 / poe2 /sck4 54 pb3 pb3/ irq1 / poe1 /txd4 pb3 pb3/ irq1 / poe1 /txd4 55 pb2 pb2/ irq0 / poe0 /rxd4 pb2 pb2/ irq0 / poe0 /rxd4 56 a17 a17 pb1 pb1/a17/hrxd1/sck4 57 a16 a16 pb0 pb0/a16/htxd1 58 pa15/ trst * pa15/ck/ poe6 / trst * / back pa15/ trst * pa15/ck/ poe6 / trst * / back 59 pa14/tms * pa14/ rd / poe5 /tms * pa14/tms * pa14/ rd / poe5 /tms * 60 pa13/tdo * pa13/ poe4 /tdo * / breq pa13/tdo * pa13/ poe4 /tdo * / breq 61 pa12/tdi * pa12/ wrl / ubctrg * /tdi * pa12/tdi * pa12/ wrl / ubctrg * /tdi * 62 pa11 pa11/ adtrg /sck3 pa11 pa11/ adtrg /sck3 63 pa10/tck * pa10/ cs0 / rd /tck * /sck2 pa10/tck * pa10/ cs0 / rd /tck * /sck2 64 pa9 pa9/tclkd/ irq3 /txd3 pa9 pa9/tclkd/ irq3 /txd3 65 pa8 pa8/tclkc/ irq2 /rxd3 pa8 pa8/tclkc/ irq2 /rxd3 66 pa7 pa7/tclkb/ wait /txd2 pa7 pa7/tclkb/ wait /txd2 67 rd rd pa6 pa6/tclka/ rd /rxd2 68 a5 a5 pa5 pa5/ irq1 /a5/ poe6 /sck3
rev. 2.00, 09/04, page 521 of 720 pin name on-chip rom disabled on-chip rom enabled pin no. initial function pfc selected function possibilities initial function pfc selected function possibilities 69 a4 a4 pa4 pa4/a4/ poe5 /txd3 70 a3 a3 pa3 pa3/a3/ poe4 /rxd3 71 a2 a2 pa2 pa2/ irq0 /a2/pcio/sck2 73 a1 a1 pa1 pa1/a1/ poe1 /txd2 75 a0 a0 pa0 pa0/a0/ poe0 /rxd2 76 pd8 pd8/ ubctrg * pd8 pd8/ ubctrg * 78 d7 d7 pd7/ audsync * pd7/d7/ audsync * 79 d6 d6 pd6/audck * pd6/d6/audck * 80 d5 d5 pd5/audmd * pd5/d5/audmd * 81 d4 d4 pd4/ audrst * pd4/d4/ audrst * 83 fwp fwp fwp fwp 85 hstby hstby hstby hstby 86 d3 d3 pd3/audata3 * pd3/d3/audata3 * 87 res res res res 88 d2 d2 pd2/audata2 * pd2/d2/sck2/audata2 * 89 nmi nmi nmi nmi 90 d1 d1 pd1/audata1 * pd1/d1/txd2/audata1 * 91 md3 md3 md3 md3 92 d0 d0 pd0/audata0 * pd0/d0/rxd2/audata0 * 93 md2 md2 md2 md2 94 md1 md1 md1 md1 95 md0 md0 md0 md0 96 extal extal extal extal 97 xtal xtal xtal xtal 98 pllvcl pllvcl pllvcl pllvcl 99 pllcap pllcap pllcap pllcap 100 pllvss pllvss pllvss pllvss note: * f-ztat only. in on-chip rom disable mode and on-chip rom enable mode, do not set functions other than those that can be set by pfc listed in this table.
rev. 2.00, 09/04, page 522 of 720 table 17.7 sh7047 pin functions in each mode (2) pin name single chip mode pin no. initial function pfc selected function possibilities 15, 53, 72, 84 vcc vcc 13, 29, 50, 74, 82 vss vss 27, 77 vcl vcl 33, 46 avcc avcc 30, 49 avss avss 1 wdtovf wdtovf 2 pe0 pe0/tioc0a 3 pe1 pe1/tioc0b 4 pe2 pe2/tioc0c 5 pe3 pe3/tioc0d 6 pe4 pe4/tioc1a/rxd3 7 pe5 pe5/tioc1b/txd3 8 pe6 pe6/tioc2a/sck3 9 pe7 pe7/tioc2b/rxd2 10 pe8 pe8/tioc3a/sck2 11 asebrkak * asebrkak * 12 pe9 pe9/tioc3b 14 pe10 pe10/tioc3c/txd2 16 dbgmd * dbgmd * 17 pe11 pe11/tioc3d 18 pe12 pe12/tioc4a 19 pe13 pe13/tioc4b/ mres 20 pe14 pe14/tioc4c 21 pe15 pe15/tioc4d/ irqout 22 pe16 pe16/puoa/ ubctrg * 23 pe17 pe17/pvoa 24 pe18 pe18/pwoa 25 pe19 pe19/puob/rxd4 26 pe20 pe20/pvob/txd4 28 pe21 pe21/pwob/sck4 31 pf7/an7 pf7/an7 32 pf15/an15 pf15/an15 34 pf6/an6 pf6/an6
rev. 2.00, 09/04, page 523 of 720 pin name single chip mode pin no. initial function pfc selected function possibilities 35 pf14/an14 pf14/an14 36 pf5/an5 pf5/an5 37 pf13/an13 pf13/an13 38 pf4/an4 pf4/an4 39 pf12/an12 pf12/an12 40 pf11/an11 pf11/an11 41 pf3/an3 pf3/an3 42 pf10/an10 pf10/an10 43 pf2/an2 pf2/an2 44 pf9/an9 pf9/an9 45 pf1/an1 pf1/an1 47 pf8/an8 pf8/an8 48 pf0/an0 pf0/an0 51 pb5 pb5/ irq3 / poe3 /ck 52 pb4 pb4/ irq2 / poe2 /sck4 54 pb3 pb3/ irq1 / poe1 /txd4 55 pb2 pb2/ irq0 / poe0 /rxd4 56 pb1 pb1/hrxd1/sck4 57 pb0 pb0/htxd1 58 pa15/ trst * pa15/ck/ poe6 / trst * 59 pa14/tms * pa14/ poe5 /tms * 60 pa13/tdo * pa13/ poe4 /tdo * 61 pa12/tdi * pa12/ ubctrg /tdi * 62 pa11 pa11/ adtrg /sck3 63 pa10/tck * pa10/tck * /sck2 64 pa9 pa9/tclkd/ irq3 /txd3 65 pa8 pa8/tclkc/ irq2 /rxd3 66 pa7 pa7/tclkb/txd2 67 pa6 pa6/tclka/rxd2 68 pa5 pa5/ irq1 / poe6 /sck3 69 pa4 pa4/ poe5 /txd3 70 pa3 pa3/ poe4 /rxd3 71 pa2 pa2/ irq0/ pcio/sck2 73 pa1 pa1/ poe1 /txd2
rev. 2.00, 09/04, page 524 of 720 pin name single chip mode pin no. initial function pfc selected function possibilities 75 pa0 pa0/ poe0 /rxd2 76 pd8 pd8/ ubctrg * 78 pd7/ audsync * pd7/ audsync * 79 pd6/audck * pd6/audck * 80 pd5/audmd * pd5/audmd * 81 pd4/ audrst * pd4/ audrst * 83 fwp fwp 85 hstby hstby 86 pd3/audata3 * pd3/audata3 * 87 res res 88 pd2/audata2 * pd2/sck2/audata2 * 89 nmi nmi 90 pd1/audata1 * pd1/txd2/audata1 * 91 md3 md3 92 pd0/audata0 * pd0/rxd2/audata0 * 93 md2 md2 94 md1 md1 95 md0 md0 96 extal extal 97 xtal xtal 98 pllvcl pllvcl 99 pllcap pllcap 100 pllvss pllvss note: * f-ztat only. in single chip mode, do not set functions other than those that c an be set by pfc listed in this table.
rev. 2.00, 09/04, page 525 of 720 17.1 register descriptions the registers listed below make up the pin function controller (pfc). for details on the addresses of the registers and their states during each process, see appe ndix a, internal i/o register. ? port a i/o register l (paiorl) ? port a control register l3 (pacrl3) ? port a control register l2 (pacrl2) ? port a control register l1 (pacrl1) ? port b i/o register (pbior) ? port b control register 1 (pbcr1) ? port b control register 2 (pbcr2) ? port d i/o register l (pdiorl) ? port d control register l1 (pdcrl1) ? port d control register l2 (pdcrl2) ? port e i/o register h (peiorh) ? port e i/o register l (peiorl) ? port e control register h (pecrh) ? port e control register l1 (pecrl1) ? port e control register l2 (pecrl2) 17.1.1 port a i/o register l (paiorl) the port a i/o register l (paiorl) is a 16-bit read able/writable register that is used to set the pins on port a as inputs or outputs. bits pa15ior to pa0ior correspond to pins pa15 to pa0 (names of multiplexed pins are here given as port names and pin numbers alone). paiorl is enabled when the port a pins are functioning as general-purpose inputs/outputs (pa15 to pa0), sck2 and sck3 pins are functioning as inputs/outputs of sci, and pcio pins are functioning as an input/output of mmt. in other states, paiorl is disabled. a given pin on port a will be an output pin if the corresponding bit in paiorl is set to 1, and an input pin if the bit is cleared to 0. the initial value of paiorl is h'0000. 17.1.2 port a control registers l3 to l1 (pacrl3 to pacrl1) the port a control registers l3 to l1 (pacrl3 to pacrl1) are 16-bit read able/writable registers that are used to select the functions of the multiplexed pins on port a.
rev. 2.00, 09/04, page 526 of 720 port a control registers l3 to l1 (pacrl3 to pacrl1) register bit bit name initial value r/w description pacrl3 pacrl1 pacrl1 15 15 14 pa15md2 pa15md1 pa15md0 0 * 2 0 0 r/w r/w r/w pa15 mode select the function of the pa15/ck/ poe6 / trst / back pin. 000: pa15 i/o (port) 100: trst input (h-udi) * 1 001: ck output (cpg) 101: back output (bsc) 010: poe6 input (port) 110: setting prohibited 011: setting prohibited 111: setting prohibited pacrl3 pacrl1 pacrl1 14 13 12 pa14md2 pa15md1 pa14md0 0 * 2 0 0 r/w r/w r/w pa14 mode select the function of the pa14/ rd / poe5 /tms pin. 000: pa14 i/o (port) 100: tms input (h-udi) * 1 001: rd output (bsc) 101: setting prohibited 010: poe5 input (port) 110: setting prohibited 011: setting prohibited 111: setting prohibited pacrl3 pacrl1 pacrl1 13 11 10 pa13md2 pa13md1 pa13md0 0 * 2 0 0 r/w r/w r/w pa13 mode select the function of the pa13/ poe4 /tdo/ breq pin. 000: pa13 i/o (port) 100: tdo output(h-udi) * 1 001: setting prohibited 101: breq input (bsc) 010: poe4 input (port) 110: setting prohibited 011: setting prohibited 111: setting prohibited pacrl3 pacrl1 pacrl1 12 9 8 pa12md2 pa12md1 pa12md0 0 * 2 0 0 r/w r/w r/w pa12 mode select the function of the pa12/ wrl / ubctrg /tdi pin. 000: pa12 i/o (port) 100: tdi input (h-udi) * 1 001: wrl output (bsc) 101: setting prohibited 010: ubctrg output (ubc) * 1 110: setting prohibited 011: setting prohibited 111: setting prohibited pacrl3 pacrl1 pacrl1 11 7 6 pa11md2 pa11md1 pa11md0 0 0 0 r/w r/w r/w pa11 mode select the function of the pa11/ adtrg /sck3 pin. 000: pa11 i/o (port) 100: setting prohibited 001: setting prohibited 101: sck3 i/o (sci) 010: adtrg input (a/d) 110: setting prohibited 011: setting prohibited 111: setting prohibited
rev. 2.00, 09/04, page 527 of 720 register bit bit name initial value r/w description pacrl3 pacrl1 pacrl1 10 5 4 pa10md2 pa10md1 pa10md0 0 * 2 0 0 r/w r/w r/w pa10 mode select the function of the pa10/ cs0 / rd /tck/sck2 pin. 000: pa10 i/o (port) 100: tck input (h-udi) * 1 001: cs0 output (bsc) 101: sck2 i/o (sci) 010: rd output (bsc) 110: setting prohibited 011: setting prohibited 111: setting prohibited pacrl3 pacrl1 pacrl1 9 3 2 pa9md2 pa9md1 pa9md0 0 0 0 r/w r/w r/w pa9 mode select the function of the pa9/tclkd/ irq3 /txd3 pin. 000: pa9 i/o (port) 100: setting prohibited 001: tclkd input (mtu) 101: txd3 output (sci) 010: irq3 input (intc) 110: setting prohibited 011: setting prohibited 111: setting prohibited pacrl3 pacrl1 pacrl1 8 1 0 pa8md2 pa8md1 pa8md0 0 0 0 r/w r/w r/w pa8 mode select the function of the pa8/tclkc/ irq2 /rxd3 pin. 000: pa8 i/o (port) 100: setting prohibited 001: tclkc input (mtu) 101: rxd3 input (sci) 010: irq2 input (intc) 110: setting prohibited 011: setting prohibited 111: setting prohibited pacrl3 pacrl2 pacrl2 7 15 14 pa7md2 pa7md1 pa7md0 0 0 0 r/w r/w r/w pa7 mode select the function of the pa7/tclkb/ wait /txd2 pin. 000: pa7 i/o (port) 100: setting prohibited 001: tclkb input (mtu) 101: txd2 output (sci) 010: setting prohibited 110: setting prohibited 011: wait input (bsc) 111: setting prohibited pacrl3 pacrl2 pacrl2 6 13 12 pa6md2 pa6md1 pa6md0 0 0 * 3 0 * 3 r/w r/w r/w pa6 mode select the function of the pa6/tclka/ rd /rxd2 pin. 000: pa6 i/o (port) 100: setting prohibited 001: tclka input (mtu) 101: rxd2 input (sci) 010: setting prohibited 110: setting prohibited 011: rd output (bsc) 111: setting prohibited pacrl3 pacrl2 pacrl2 5 11 10 pa5md2 pa5md1 pa5md0 0 * 3 0 0 r/w r/w r/w pa5 mode select the function of the pa5/ irq1 /a5/ poe6 /sck3 pin. 000: pa5 i/o (port) 100: a5 output (bsc) 001: setting prohibited 101: poe6 input (port) 010: setting prohibited 110: sck3 i/o (sci) 011: irq1 input (intc) 111: setting prohibited
rev. 2.00, 09/04, page 528 of 720 register bit bit name initial value r/w description pacrl3 pacrl2 pacrl2 4 9 8 pa4md2 pa4md1 pa4md0 0 * 3 0 0 r/w r/w r/w pa4 mode select the function of the pa4/a4/ poe5 /txd3 pin. 000: pa4 i/o (port) 100: a4 output (bsc) 001: setting prohibited 101: poe5 input (port) 010: setting prohibited 110: txd3 output (sci) 011: setting prohibited 111: setting prohibited pacrl3 pacrl2 pacrl2 3 7 6 pa3md2 pa3md1 pa3md0 0 * 3 0 0 r/w r/w r/w pa3 mode select the function of the pa3/a3/ poe4 /rxd3 pin. 000: pa3 i/o (port) 100: a3 output (bsc) 001: setting prohibited 101: poe4 input (port) 010: setting prohibited 110: rxd3 input (sci) 011: setting prohibited 111: setting prohibited pacrl3 pacrl2 pacrl2 2 5 4 pa2md2 pa2md1 pa2md0 0 * 3 0 0 r/w r/w r/w pa2 mode select the function of the pa2/ irq0 /a2/pcio/sck2 pin. 000: pa2 i/o (port) 100: a2 output (bsc) 001: setting prohibited 101: pcio i/o (mmt) 010: setting prohibited 110: sck2 i/o (sci) 011: irq0 input (intc) 111: setting prohibited pacrl3 pacrl2 pacrl2 1 3 2 pa1md2 pa1md1 pa1md0 0 * 3 0 0 r/w r/w r/w pa1 mode select the function of the pa1/a1/ poe1 /txd2 pin. 000: pa1 i/o (port) 100: a1 output (bsc) 001: setting prohibited 101: poe1 input (port) 010: setting prohibited 110: txd2 output (sci) 011: setting prohibited 111: setting prohibited pacrl3 pacrl2 pacrl2 0 1 0 pa0md2 pa0md1 pa0md0 0 * 3 0 0 r/w r/w r/w pa0 mode select the function of the pa0/a0/ poe0 /rxd2 pin. 000: pa0 i/o (port) 100: a0 output (bsc) 001: setting prohibited 101: poe0 input (port) 010: setting prohibited 110: rxd2 input (sci) 011: setting prohibited 111: setting prohibited notes: 1. f-ztat only. setting prohibited for the mask version. 2. the initial value is 1 in the e10a debug ging mode which is specified by a low level on dbgmd . 3. the initial value is 1 in the on-chip rom disabled 8-bit external-expansion mode.
rev. 2.00, 09/04, page 529 of 720 17.1.3 port b i/o register (pbior) the port b i/o register (pbior) is a 16-bit readable/writable register th at is used to set the pins on port b as inputs or outputs. bits pb5ior to pb0ior correspond to pins pb5 to pb0 (names of multiplexed pins are here given as port names and pin numbers alone). pbior is enabled when port b pins are functioning as general-purpose inputs/outputs (pb5 to pb0) and sck4 pins are functioning as inputs/outputs of sci. in other states, pbior is disabled. a given pin on port b will be an output pin if the corresponding bit in pbior is set to 1, and an input pin if the bit is cleared to 0. bits 15 to 6 are reserved. these bits are always read as 0 and should only be written with 0. the initial vale of pbior is h'0000. 17.1.4 port b control registers 1 and 2 (pbcr1 and pbcr2) the port b control registers 1 and 2 (pbcr1 and pbcr2) are 16-bit readable/writable registers that are used to select the multiplexed pin function of the pins on port b. port b control registers 1 and 2 (pbcr1 and pbcr2) register bit bit name initial value r/w description pbcr1 pbcr1 pbcr2 15 to 14 8 to 0 15 to 12 ? ? ? all 0 all 0 all 0 r r r reserved these bits are always read as 0 and should only be written with 0. pbcr1 pbcr2 pbcr2 13 11 10 pb5md2 pb5md1 pb5md0 0 * 1 0 0 * 1 r/w r/w r/w pb5 mode select the function of the pb5/ irq3 / poe3 /ck pin. 000: pb5 i/o (port) 100: setting prohibited 001: irq3 input (intc) 101: ck output (cpg) 010: poe3 input (port) 110: setting prohibited 011: setting prohibited 111: setting prohibited pbcr1 pbcr2 pbcr2 12 9 8 pb4md2 pb4md1 pb4md0 0 0 0 r/w r/w r/w pb4 mode select the function of the pb4/ irq2 / poe2 /sck4 pin. 000: pb4 i/o (port) 100: setting prohibited 001: irq2 input (intc) 101: setting prohibited 010: poe2 input (port) 110: setting prohibited 011: setting prohibited 111: sck4 i/o (sci)
rev. 2.00, 09/04, page 530 of 720 register bit bit name initial value r/w description pbcr1 pbcr2 pbcr2 11 7 6 pb3md2 pb3md1 pb3md0 0 0 0 r/w r/w r/w pb3 mode select the function of the pb3/ irq1 / poe1 /txd4 pin. 000: pb3 i/o (port) 100: setting prohibited 001: irq1 input (intc) 101: setting prohibited 010: poe1 input (port) 110: setting prohibited 011: setting prohibited 111: txd4 output (sci) pbcr1 pbcr2 pbcr2 10 5 4 pb2md2 pb2md1 pb2md0 0 0 0 r/w r/w r/w pb2 mode select the function of the pb2/ irq0 / poe0 /rxd4 pin. 000: pb2 i/o (port) 100: setting prohibited 001: irq0 input (intc) 101: setting prohibited 010: poe0 input (port) 110: setting prohibited 011: setting prohibited 111: rxd4 input (sci) pbcr1 pbcr2 pbcr2 9 3 2 pb1md2 pb1md1 pb1md0 0 0 0 * 2 r/w r/w r/w pb1 mode select the function of the pb1/a17/hrxd1/sck4 pin. 000: pb1 i/o (port) 100: setting prohibited 001: a17 output (bsc) 101: setting prohibited 010: setting prohibited 110: setting prohibited 011: hrxd1 input (hcan2) 111: sck4 i/o (sci) pbcr2 pbcr2 1 0 pb0md1 pb0md0 0 0 * 2 r/w r/w pb0 mode select the function of the pb0/a16/htxd1 pin. 00: pb0 i/o (port) 10: setting prohibited 01: a16 output (bsc) 11: htxd1 output (hcan2) notes: 1. the initial value is 1 in the on-chip rom enabled/disabled 8-bit external-expansion mode. 2. the initial value is 1 in the on-chip rom disabled 8-bit external-expansion mode. 17.1.5 port d i/o register l (pdiorl) the port d i/o register l (pdiorl) is a 16-bit read able/writable register that is used to set the pins on port d as inputs or outputs. bits pd8ior to pd0ior correspond to pins pd8 to pd0 (names of multiplexed pins are here given as port names and pin numbers alone). pdiorl is enabled when the port d pins are functioning as general-purpose inputs/outputs (pd8 to pd0) and sck2 pins are functioning as inputs/outputs of sci. in other states, pdiorl is disabled. a given pin on port d will be an output pin if the corresponding bit in pdiorl is set to 1, and an input pin if the bit is cleared to 0. bits 15 to 9 of pdiorl are reserved. these bits ar e always read as 0 and should only be written with 0.
rev. 2.00, 09/04, page 531 of 720 the initial value of pdiorl is h'0000. 17.1.6 port d control registers l1 and l2 (pdcrl1 and pdcrl2) the port d control registers l1 and l2 (pdc rl1 and pdcrl2) are 16-b it readable/writable registers that are used to select the multiplexed pin function of the pins on port d. port d control registers l1 and l2 (pdcrl1 and pdcrl2) register bit bit name initial value r/w description pdcrl2 pdcrl1 15 to 9 15 to 9 ? ? all 0 all 0 r r reserved these bits are always read as 0 and should only be written with 0. pdcrl2 pdcrl1 8 8 pd8md1 pd8md0 0 0 r/w r/w pd8 mode select the function of the pd8/ ubctrg pin. 00: pd8 i/o (port) 10: setting prohibited 01: setting prohibited 11: ubctrg output (ubc) * 1 pdcrl2 pdcrl1 7 7 pd7md1 pd7md0 0 0 * 2 r/w r/w pd7 mode select the function of the pd7/d7/ audsync pin. 00: pd7 i/o (port) 10: setting prohibited 01: d7 i/o (bsc) 11: audsync i/o (aud) * 1 pdcrl2 pdcrl1 6 6 pd6md1 pd6md0 0 0 * 2 r/w r/w pd6 mode select the function of the pd6/d6/audck pin. 00: pd6 i/o (port) 10: setting prohibited 01: d6 i/o (bsc) 11: audck i/o (aud) * 1 pdcrl2 pdcrl1 5 5 pd5md1 pd5md0 0 0 * 2 r/w r/w pd5 mode select the function of the pd5/d5/audmd pin. 00: pd5 i/o (port) 10: setting prohibited 01: d5 i/o (bsc) 11: audmd input (aud) * 1 pdcrl2 pdcrl1 4 4 pd4md1 pd4md0 0 0 * 2 r/w r/w pd4 mode select the function of the pd4/d4/ audrst pin. 00: pd4 i/o (port) 10: setting prohibited 01: d4 i/o (bsc) 11: audrst input (aud) * 1 pdcrl2 pdcrl1 3 3 pd3md1 pd3md0 0 0 * 2 r/w r/w pd3 mode select the function of the pd3/d3/audata3 pin. 00: pd3 i/o (port) 10: setting prohibited 01: d3 i/o (bsc) 11: audata3 i/o (aud) * 1
rev. 2.00, 09/04, page 532 of 720 register bit bit name initial value r/w description pdcrl2 pdcrl1 2 2 pd2md1 pd2md0 0 0 * 2 r/w r/w pd2 mode select the function of the pd2/d2/sck2/audata2 pin. 00: pd2 i/o (port) 10: sck2 i/o (sci) 01: d2 i/o (bsc) 11: audata2 i/o (aud) * 1 pdcrl2 pdcrl1 1 1 pd1md1 pd1md0 0 0 * 2 r/w r/w pd1 mode select the function of the pd1/d1/txd2/audata1 pin. 00: pd1 i/o (port) 10: txd2 output (sci) 01: d1 i/o (bsc) 11: audata1 i/o (aud) * 1 pdcrl2 pdcrl1 0 0 pd0md1 pd0md0 0 0 * 2 r/w r/w pd0 mode select the function of the pd0/d0/rxd2/audata0 pin. 00: pd0 i/o (port) 10: rxd2 input (sci) 01: d0 i/o (bsc) 11: audata0 i/o (aud) * 1 notes: 1. f-ztat only. setting prohibited for the mask version. 2. the initial value is 1 in the on-chip rom disabled 8-bit external-expansion mode. 17.1.7 port e i/o registers l and h (peiorl and peiorh) the port e i/o registers l and h (peiorl and pe iorh) are 16-bit readable/writable registers that are used to set the pins on port e as inputs or outputs. bits pe21ior to pe0ior correspond to pins pe21 to pe0 (names of multiplexed pins are here given as port names and pin numbers alone). peiorl is enabled when the port e pins are functioning as general-purpose inputs/outputs (pe15 to pd0), tioc pins are functioning as inputs/outputs of mtu, and sck2 and sck3 pins are functioning as inputs/outputs of sci. in other states, peiorl is disabled. peiorh is enabled when the port e pins are functioning as general-purpose inputs/outputs (pe21 to pe16) and sck4 pins are functioning as inputs/outputs of sci. in other states, peiorh is disabled. a given pin on port e will be an output pin if the corresponding peiorl or peiorh bit is set to 1, and an input pin if the bit is cleared to 0. bits 15 to 6 of peiorh are reserved. these bits ar e always read as 0 and should only be written with 0. the initial values of peiorl and peiorh are h'0000.
rev. 2.00, 09/04, page 533 of 720 17.1.8 port e control registers l1, l2, and h (pecrl1, pecrl2, and pecrh) the port e control registers l1, l2, and h (pecrl1, pecrl2 and pecrh) are 16-bit readable/writable registers that are used to select the multiplexed pin function of the pins on port e. port e control registers l1, l2, and h (pecrl1, pecrl2, and pecrh) register bit bit name initial value r/w description pecrh 15 to 12 ? all 0 r reserved these bits are always read as 0 and should only be written with 0. pecrh pecrh 11 10 pe21md1 pe21md0 0 * 2 0 * 2 r/w r/w pe21 mode select the function of the pe21/pwob/sck4/a15 pin. 00: pe21 i/o (port) 10: sck4 i/o (sci) 01: pwob output (mmt) 11: a15 output (bsc) pecrh pecrh 9 8 pe20md1 pe20md0 0 * 2 0 * 2 r/w r/w pe20 mode select the function of the pe20/pvob/txd4/a14 pin. 00: pe20 i/o (port) 10: txd4 output (sci) 01: pvob output (mmt) 11: a14 output (bsc) pecrh pecrh 7 6 pe19md1 pe19md0 0 * 2 0 * 2 r/w r/w pe19 mode select the function of the pe19/puob/rxd4/a13 pin. 00: pe19 i/o (port) 10: rxd4 input (sci) 01: puob output (mmt) 11: a13 output (bsc) pecrh pecrh 5 4 pe18md1 pe18md0 0 * 2 0 * 2 r/w r/w pe18 mode select the function of the pe18/pwoa/a12 pin. 00: pe18 i/o (port) 10: setting prohibited 01: pwoa output (mmt) 11: a12 output (bsc) pecrh pecrh 3 2 pe17md1 pe17md0 0 * 2 0 * 2 r/w r/w pe17 mode select the function of the pe17/pvoa/ wait /a11 pin. 00: pe17 i/o (port) 10: wait input (bsc) 01: pvoa output (mmt) 11: a11 output (bsc) pecrh pecrh 1 0 pe16md1 pe16md0 0 * 2 0 * 2 r/w r/w pe16 mode select the function of the pe16/puoa/ ubctrg /a10 pin. 00: pe16 i/o (port) 10: ubctrg output (ubc) * 1 01: puoa output (mmt) 11: a10 output (bsc)
rev. 2.00, 09/04, page 534 of 720 register bit bit name initial value r/w description pecrl1 pecrl1 15 14 pe15md1 pe15md0 0 0 r/w r/w pe15 mode select the function of the pe15/tioc4d/ irqout pin. 00: pe15 i/o (port) 10: setting prohibited 01: tioc4d i/o (mtu) 11: irqout output (intc) pecrl1 pecrl1 13 12 pe14md1 pe14md0 0 0 r/w r/w pe14 mode select the function of the pe14/tioc4c pin. 00: pe14 i/o (port) 10: setting prohibited 01: tioc4c i/o (mtu) 11: setting prohibited pecrl1 pecrl1 11 10 pe13md1 pe13md0 0 0 r/w r/w pe13 mode select the function of the pe13/tioc4b/ mres pin. 00: pe13 i/o (port) 10: mres input (intc) 01: tioc4b i/o (mtu) 11: setting prohibited pecrl1 pecrl1 9 8 pe12md1 pe12md0 0 0 r/w r/w pe12 mode select the function of the pe12/tioc4a pin. 00: pe12 i/o (port) 10: setting prohibited 01: tioc4a i/o (mtu) 11: setting prohibited pecrl1 pecrl1 7 6 pe11md1 pe11md0 0 0 r/w r/w pe11 mode select the function of the pe11/tioc3d pin. 00: pe11 i/o (port) 10: setting prohibited 01: tioc3d i/o (mtu) 11: setting prohibited pecrl1 pecrl1 5 4 pe10md1 pe10md0 0 * 2 0 * 2 r/w r/w pe10 mode select the function of the pe10/tioc3c/txd2/ wrl pin. 00: pe10 i/o (port) 10: txd2 output (sci) 01: tioc3c i/o (mtu) 11: wrl output (bsc) pecrl1 pecrl1 3 2 pe9md1 pe9md0 0 0 r/w r/w pe9 mode select the function of the pe9/tioc3b pin. 00: pe9 i/o (port) 10: setting prohibited 01: tioc3b i/o (mtu) 11: setting prohibited pecrl1 pecrl1 1 0 pe8md1 pe8md0 0 0 r/w r/w pe8 mode select the function of the pe8/tioc3a/sck2 pin. 00: pe8 i/o (port) 10: sck2 i/o (sci) 01: tioc3a i/o (mtu) 11: setting prohibited pecrl2 pecrl2 15 14 pe7md1 pe7md0 0 * 2 0 * 2 r/w r/w pe7 mode select the function of the pe7/tioc2b/rxd2/a9 pin. 00: pe7 i/o (port) 10: rxd2 input (sci) 01: tioc2b i/o (mtu) 11: a9 output (bsc)
rev. 2.00, 09/04, page 535 of 720 register bit bit name initial value r/w description pecrl2 pecrl2 13 12 pe6md1 pe6md0 0 * 2 0 * 2 r/w r/w pe6 mode select the function of the pe6/tioc2a/sck3/a8 pin. 00: pe6 i/o (port) 10: sck3 i/o (sci) 01: tioc2a i/o (mtu) 11: a8 output (bsc) pecrl2 pecrl2 11 10 pe5md1 pe5md0 0 * 2 0 * 2 r/w r/w pe5 mode select the function of the pe5/tioc1b/txd3/a7 pin. 00: pe5 i/o (port) 10: txd3 output (sci) 01: tioc1b i/o (mtu) 11: a7 output (bsc) pecrl2 pecrl2 9 8 pe4md1 pe4md0 0 * 2 0 * 2 r/w r/w pe4 mode select the function of the pe4/tioc1a/rxd3/a6 pin. 00: pe4 i/o (port) 10: rxd3 input (sci) 01: tioc1a i/o (mtu) 11: a6 output (bsc) pecrl2 pecrl2 7 6 pe3md1 pe3md0 0 0 r/w r/w pe3 mode select the function of the pe3/tioc0d pin. 00: pe3 i/o (port) 10: setting prohibited 01: tioc0d i/o (mtu) 11: setting prohibited pecrl2 pecrl2 5 4 pe2md1 pe2md0 0 0 r/w r/w pe2 mode select the function of the pe2/tioc0c pin. 00: pe2 i/o (port) 10: setting prohibited 01: tioc0c i/o (mtu) 11: setting prohibited pecrl2 pecrl2 3 2 pe1md1 pe1md0 0 0 r/w r/w pe1 mode select the function of the pe1/tioc0b pin. 00: pe1 i/o (port) 10: setting prohibited 01: tioc0b i/o (mtu) 11: setting prohibited pecrl2 pecrl2 1 0 pe0md1 pe0md0 0 * 2 0 * 2 r/w r/w pe0 mode select the function of the pe0/tioc0a/ cs0 pin. 00: pe0 i/o (port) 10: setting prohibited 01: tioc0a i/o (mtu) 11: cs0 output (bsc) notes: 1. f-ztat only. setting prohibited for the mask version. 2. the initial value is 1 in the on-chip rom disabled 8-bit external-expansion mode.
rev. 2.00, 09/04, page 536 of 720 17.2 precautions for use 1. in this lsi series, individual functions are available as multiplexed functions on multiple pins. this approach is intended to increase the number of selectable pin functions and to allow the easier design of boards. when the pin function controller (pfc) is used to select a function, only a single pin can be specified for each function. if on e function is specified for two or more pins, the function will not work properly. 2. to select a pin function, set the port control registers (pacrl3, pacrl2, pacrl1, pbcr1, pbcr2, pdcrl1, and pdcrl2) before setting the port i/o registers (paiorl, pbior, and pdior). to select the function of the pin which is multiplexed with the port e, the order of setting the port control registers (pecrh, pecrl1, and pecrl2) and port i/o registers (peiorh and peiorl) is not matter. 3. when external spaces are used, set the data input/output pins as follows by the pin function controller (pfc), according to the bus size of the cs0 space specified by the bus control register 1 (bcr1) of the bus state controller. when the cs space takes the byte (8 bits) size, set all pins d7 to d0 as data input/output pins. 4. regarding the pin in which input/output port is multiplexed with dreq or irq , when the port input is changed from low level to dreq edge or irq edge detection mode, the corresponding edge is detected. 5. in a state where the pin is in general i/o mode and set to 1-output (specifically, the port control register is in general i/o mode and both the port i/o register and the port data register are set to 1), a power-on reset through the res pin may generate a low level on this pin upon the power- on state is realized. to prevent this low level from happening, set the port i/o register to 0 (general output) and then apply the power-on reset. note, however, that no low level may be generated internally by the power-on reset due to the wdt overflow.
rev. 2.00, 09/04, page 537 of 720 section 18 i/o ports this lsi has five ports: a, b, d, e, and f. port a is a 16-bit port, port b is a 6-bit port, port d is a 9-bit port, and port e is a 22-bit port, all supporting both input and output. port f is a 16-bit input- only port. all the port pins are multiplexed as general input/output pins and special function pins. the functions of the multiplex pins are selected by me ans of the pin function controller (pfc). each port is provided with a data register for storing the pin data. 18.1 port a port a is an input/output port with the 16 pins shown in figure 18.1. pa15 (i/o) / ck (output) / poe6 (input) / trst (input) * / back (output) pa14 (i/o) / rd (output) / poe5 (input) / tms (input) * pa13 (i/o) / poe4 (input) / tdo (output) * / breq (input) pa12 (i/o) / wrl (output) / ubctrg (output) * / tdi (input) * pa11 (i/o) / adtrg (input) / sck3 (i/o) pa10 (i/o) / cs0 (output) / rd (output) / tck (input) * / sck2 (i/o) pa9 (i/o) / tclkd (input) / irq3 (input) / txd3 (output) pa8 (i/o) / tclkc (input) / irq2 (input) / rxd3 (input) pa7 (i/o) / tclkb (input) / wait (input) / txd2 (output) pa6 (i/o) / tclka (input) / rd (output) / rxd2 (input) pa5 (i/o) / irq1 (input) / a5 (output) / poe6 (input) / sck3 (i/o) pa4 (i/o) / a4 (output) / poe5 (input) / txd3 (output) pa3 (i/o) / a3 (output) / poe4 (input) / rxd3 (input) pa2 (i/o) / irq0 (input) / a2 (output) / pcio (i/o) / sck2 (i/o) pa1 (i/o) / a1 (output) / poe1 (input) / txd2 (output) pa0 (i/o) / a0 (output) / poe0 (input) / rxd2 (input) note: * only for the f-ztat version (no corresponding function in the mask version.) port a figure 18.1 port a
rev. 2.00, 09/04, page 538 of 720 18.1.1 register descriptions port a is a 16-bit input/output port. port a has the following register. for details on register addresses and register states during each processi ng, refer to appendix a, internal i/o register. ? port a data register l (padrl) 18.1.2 port a data register l (padrl) the port a data register l (padrl) is a 16-bit readable/writable register that stores port a data. bits pa15dr to pa0dr correspond to pins pa15 to pa0 (multiplexed functions omitted here). when a pin functions is a general output, if a value is written to padrl, that value is output directly from the pin, and if padrl is read, the register value is returned directly regardless of the pin state. when a pin functions is a general input, if padrl is read, the pin state, not the register value, is returned directly. if a value is written to padrl, although that value is written into padrl, it does not affect the pin state. table 18.1 summarizes port a data register l read/write operations. bit bit name initial value r/w description 15 pa15dr 0 r/w see table 18.1 14 pa14dr 0 r/w 13 pa13dr 0 r/w 12 pa12dr 0 r/w 11 pa11dr 0 r/w 10 pa10dr 0 r/w 9 pa9dr 0 r/w 8 pa8dr 0 r/w 7 pa7dr 0 r/w 6 pa6dr 0 r/w 5 pa5dr 0 r/w 4 pa4dr 0 r/w 3 pa3dr 0 r/w 2 pa2dr 0 r/w 1 pa1dr 0 r/w 0 pa0dr 0 r/w
rev. 2.00, 09/04, page 539 of 720 table 18.1 port a data register l (padrl) read/write operations bits 15 to 0: paiorl pin function read write 0 general input pin state can write to padrl, but it has no effect on pin state other than general input pin state can write to padrl, but it has no effect on pin state 1 general output padrl value valu e written is output from pin other than general output padrl value can write to padrl, but it has no effect on pin state 18.2 port b port b is an input/output port with the six pins shown in figure 18.2. port b pb5 (i/o) / irq3 (input) / poe3 (input) / ck (output) pb4 (i/o) / irq2 (input) / poe2 (input) / sck4 (i/o) pb3 (i/o) / irq1 (input) / poe1 (input) / txd4 (output) pb2 (i/o) / irq0 (input) / poe0 (input) / rxd4 (input) pb1 (i/o) / a17 (output) / hrxd1 (input) / sck4 (i/o) pb0 (i/o) / a16 (output) / htxd1 (output) figure 18.2 port b 18.2.1 register descriptions port b is a 6-bit input/output port. port b has the following register. for details on register addresses and register states during each processi ng, refer to appendix a, internal i/o register. ? port b data register (pbdr) 18.2.2 port b data register (pbdr) the port b data register (pbdr) is a 16-bit readab le/writable register that stores port b data. bits pb5dr to pb0dr correspond to pins pb5 to pb0 (multiplexed functions omitted here). when a pin functions is a general output, if a value is written to pbdr, that value is output directly from the pin, and if pbdr is read, the register value is returned directly regardless of the pin state.
rev. 2.00, 09/04, page 540 of 720 when a pin functions is a general input, if pbdr is read, the pin state, not the register value, is returned directly. if a value is written to pbdr, although that value is written into pbdr, it does not affect the pin state. tabl e 18.2 summarizes port b data register read/write operations. bit bit name initial value r/w description 15 to 6 ? all 0 r reserved these bits are always read as 0, and should only be written with 0. 5 pb5dr 0 r/w see table 18.2 4 pb4dr 0 r/w 3 pb3dr 0 r/w 2 pb2dr 0 r/w 1 pb1dr 0 r/w 0 pb0dr 0 r/w table 18.2 port b data regist er (pbdr) read/write operations bits 5 to 0: pbior pin function read write 0 general input pin state can write to pbdr, but it has no effect on pin state other than general input pin state can write to pbdr, but it has no effect on pin state 1 general output pbdr value valu e written is output from pin other than general output pbdr value can write to pbdr, but it has no effect on pin state
rev. 2.00, 09/04, page 541 of 720 18.3 port d port d is an input/output port with the nine pins shown in figure 18.3. pd8 (i/o) / ubctrg (output) * pd7 (i/o) / d7 (i/o) / audsync (i/o) * pd6 (i/o) / d6 (i/o) / audck (i/o) * pd5 (i/o) / d5 (i/o) / audmd (input) * pd4 (i/o) / d4 (i/o) / audrst (input) * pd3 (i/o) / d3 (i/o) / audata3 (i/o) * pd2 (i/o) / d2 (i/o) / sck2 (i/o) / audata2 (i/o) * pd1 (i/o) / d1 (i/o) / txd2 (output) / audata1 (i/o) * pd0 (i/o) / d0 (i/o) / rxd2 (input) / audata0 (i/o) * port d note: * only for the f-ztat version (no corresponding function in the mask version.) figure 18.3 port d 18.3.1 register descriptions port d has the following register. for details on register addresses and register states during each processing, refer to appendix a, internal i/o register. ? port d data register l (pddrl) 18.3.2 port d data register l (pddrl) the port d data register l (pddrl) is a 16-bit readable/writable register that stores port d data. bits pd8dr to pd0dr correspond to pins pd8 to pd0 (multiplexed functions omitted here). when a pin functions is a general output, if a value is written to pddrl, that value is output directly from the pin, and if pddrl is read, the register value is returned directly regardless of the pin state. when a pin functions is a general input, if pddrl is read, the pin state, not the register value, is returned directly. if a value is written to pddrl, although that value is written into pddrl, it does not affect the pin state. table 18.3 summarizes port d data register l read/write operations.
rev. 2.00, 09/04, page 542 of 720 bit bit name initial value r/w description 15 to 9 ? all 0 r reserved these bits are always read as 0, and should only be written with 0. 8 pd8dr 0 r/w see table 18.3 7 pd7dr 0 r/w 6 pd6dr 0 r/w 5 pd5dr 0 r/w 4 pd4dr 0 r/w 3 pd3dr 0 r/w 2 pd2dr 0 r/w 1 pd1dr 0 r/w 0 pd0dr 0 r/w table 18.3 port d data register l (pddrl) read/write operations bits 8 to 0: pdiorl pin function read write 0 general input pin state can write to pddrl, but it has no effect on pin state other than general input pin state can write to pddrl, but it has no effect on pin state 1 general output pddrl value valu e written is output from pin other than general output pddrl value can write to pddrl, but it has no effect on pin state
rev. 2.00, 09/04, page 543 of 720 18.4 port e port e is an input/output port with the 22 pins shown in figure 18.4. port e pe15 (i/o) / tioc4d (i/o) / irqout (output) pe14 (i/o) / tioc4c (i/o) pe13 (i/o) / tioc4b (i/o) / mres (input) pe12 (i/o) / tioc4a (i/o) pe11 (i/o) / tioc3d (i/o) pe10 (i/o) / tioc3c (i/o) / txd2 (output) / wrl (output) pe9 (i/o) / tioc3b (i/o) pe21 (i/o) / pwob (output) / sck4 (i/o) / a15 (output) pe20 (i/o) / pvob (output) / txd4 (output) / a14 (output) pe19 (i/o) / puob (output) / rxd4 (output) / a13 (output) pe18 (i/o) / pwoa (output) / a12 (output) pe17 (i/o) / pvoa (output) / wait (input) / a11 (output) pe16 (i/o) / puoa (output) / ubctrg (output) * / a10 (output) pe8 (i/o) / tioc3a (i/o) / sck2 (i/o) pe7 (i/o) / tioc2b (i/o) / rxd2 (input) / a9 (output) pe6 (i/o) / tioc2a (i/o) / sck3 (i/o) / a8 (output) pe5 (i/o) / tioc1b (i/o) / txd3 (output) / a7 (output) pe4 (i/o) / tioc1a (i/o) / rxd3 (input) / a6 (output) pe3 (i/o) / tioc0d (i/o) pe2 (i/o) / tioc0c (i/o) pe1 (i/o) / tioc0b (i/o) pe0 (i/o) / tioc0a (i/o) / cs0 (output) note: * only for the f-ztat version (no corresponding function in the mask version.) figure 18.4 port e
rev. 2.00, 09/04, page 544 of 720 18.4.1 register descriptions port e has the following registers. for details on register addresses and regi ster states during each processing, refer to appendix a, internal i/o register. ? port e data register h (pedrh) ? port e data register l (pedrl) 18.4.2 port e data registers h and l (pedrh and pedrl) the port e data registers h and l (pedrh and pedr l) are 16-bit readable/writable registers that store port e data. bits pe21dr to pe0dr correspond to pins pe21 to pe0 (multiplexed functions omitted here). when a pin functions is a general output, if a value is written to pedrh or pedrl, that value is output directly from the pin, and if pedrh or pedrl is read, the register value is returned directly regardless of the pin state. when a pin functions is a general input, if pedrh or pedrl is read, the pin state, not the register value, is returned directly. if a value is wri tten to pedrh or pedrl, although that value is written into pedrh or pedrl it does not affect th e pin state. table 18.4 summarizes port e data register read/write operations. pedrh: bit bit name initial value r/w description 15 to 6 ? all 0 r reserved these bits are always read as 0, and should only be written with 0. 5 pe21dr 0 r/w see table 18.4. 4 pe20dr 0 r/w 3 pe19dr 0 r/w 2 pe18dr 0 r/w 1 pe17dr 0 r/w 0 pe16dr 0 r/w
rev. 2.00, 09/04, page 545 of 720 pedrl: bit bit name initial value r/w description 15 pe15dr 0 r/w see table 18.4. 14 pe14dr 0 r/w 13 pe13dr 0 r/w 12 pe12dr 0 r/w 11 pe11dr 0 r/w 10 pe10dr 0 r/w 9 pe9dr 0 r/w 8 pe8dr 0 r/w 7 pe7dr 0 r/w 6 pe6dr 0 r/w 5 pe5dr 0 r/w 4 pe4dr 0 r/w 3 pe3dr 0 r/w 2 pe2dr 0 r/w 1 pe1dr 0 r/w 0 pe0dr 0 r/w table 18.4 port e data regi sters h and l (pedrh and pedrl) read/write operations bits 5 to 0 in pedrh and bits 15 to 0 in pedrl: peior pin function read write 0 general input pin state can write to pedrh or pedrl, but it has no effect on pin state other than general input pin state can write to pedrh or pedrl, but it has no effect on pin state 1 general output value wri tten is output from pin ( poe pin = high) * pedrh or pedrl value high impedance regardless of pedrh or pedrl value ( poe pin = low) * other than general output pedrh or pedrl value can write to pedrh or pedrl, but it has no effect on pin state note: * control by the poe pin is only available for high current-output pins (pe9 and pe11 to pe21).
rev. 2.00, 09/04, page 546 of 720 18.5 port f port f is an input-only port with the 16 pins shown in figure 18.5. port f pf15 (input) / an15 (input) pf14 (input) / an14 (input) pf13 (input) / an13 (input) pf12 (input) / an12 (input) pf11 (input) / an11 (input) pf10 (input) / an10 (input) pf9 (input) / an9 (input) pf8 (input) / an8 (input) pf7 (input) / an7 (input) pf6 (input) / an6 (input) pf5 (input) / an5 (input) pf4 (input) / an4 (input) pf3 (input) / an3 (input) pf2 (input) / an2 (input) pf1 (input) / an1 (input) pf0 (input) / an0 (input) figure 18.5 port f 18.5.1 register descriptions port f is a 16-bit input-only port. port f ha s the following register. for details on register addresses and register states during each processi ng, refer to appendix a, internal i/o register. ? port f data register (pfdr) 18.5.2 port f data register (pfdr) the port f data register (pfdr) is a 16-bit read-only register that stores port f data. bits pf15dr to pf0dr correspond to pins pf15 to pf0 (multiplexed functions omitted here). any value written into these bits is ignored, and th ere is no effect on the state of the pins. when any of the bits are read, the pin state rather than the bit value is read directly. however, when an
rev. 2.00, 09/04, page 547 of 720 a/d converter analog input is being sampled, values of 1 are read out. table 18.5 summarizes port f data register read/write operations. bit bit name initial value r/w description 15 pf15dr 0/1 * r see table 18.5. 14 pf14dr 0/1 * r 13 pf13dr 0/1 * r 12 pf12dr 0/1 * r 11 pf11dr 0/1 * r 10 pf10dr 0/1 * r 9 pf9dr 0/1 * r 8 pf8dr 0/1 * r 7 pf7dr 0/1 * r 6 pf6dr 0/1 * r 5 pf5dr 0/1 * r 4 pf4dr 0/1 * r 3 pf3dr 0/1 * r 2 pf2dr 0/1 * r 1 pf1dr 0/1 * r 0 pf0dr 0/1 * r note: * initial values are dependent on the state of the external pins. table 18.5 port f data regist er (pfdr) read/write operations bits 15 to 0 pin i/o pin function read write input general input pin state i gnored (no effect on pin state) ann input 1 ignored ( no effect on pin state)
rev. 2.00, 09/04, page 548 of 720
rev. 2.00, 09/04, page 549 of 720 section 19 flash memory (f-ztat version) the features of the flash me mory in the flash memory version are summarized below. the block diagram of the flash memory is shown in figure 19.1. 19.1 features ? size: 256 kbytes ? programming/erase methods ? the flash memory is programmed 128 bytes at a time. erase is performed in single-block units. the flash memory is configured as follows: 64 kbytes 3 blocks, 32 kbytes 1 block, and 4 kbytes 8 blocks. to erase the entire flash memory, each block must be erased in turn. ? reprogramming capability ? for details, see section 25, electrical characteristics. ? two on-board programming modes ? boot mode ? user program mode on-board programming/erasing can be done in boot mode, in which the boot program built into the chip is started to erase or progra m of the entire flash memory. in normal user program mode, individual blocks can be erased or programmed on board. ? prom programmer mode ? flash memory can be programmed/erased in programmer mode using a prom programmer, as well as in on-board programming mode. ? automatic bit rate adjustment ? with data transfer in boot mode, this lsi's b it rate can be automatically adjusted to match the transfer bit rate of the host. ? programming/erasing protection ? sets software protection against flash memory programming/erasing/verifying.
rev. 2.00, 09/04, page 550 of 720 module bus bus interface/controller flash memory (256 kbytes) operating mode flmcr2 internal address bus internal data bus (32 bits) fwp pin mode pin ebr1 ebr2 ramer flmcr1 flash memory control register 1 flash memory control register 2 erase block register 1 erase block register 2 ram emulation register [legend] flmcr1: flmcr2: ebr1: ebr2: ramer: figure 19.1 block diagram of flash memory 19.2 mode transitions when the mode pin and the fwp pin are set in the re set state and a reset-start is executed, this lsi enters an operating mode as shown in figure 19.2. in user mode, flash memory can be read but not programmed or erased. the boot, user program, and prom programmer modes are provided as modes to write and erase the flash memory. the differences between boot mode and user program mode are shown in table 19.1. figure 19.3 shows boot mode, and figure 19.4 shows user program mode.
rev. 2.00, 09/04, page 551 of 720 md1 = 0, fwp = 0 res = 0 res = 0 fwp = 0 fwp = 1 * 1 * 1 * 2 md1 = 1, fwp = 0 reset state boot mode on-board programming mode user program mode user mode (on-chip rom enabled) md1 = 1, fwp = 1 prom programmer mode res = 0 res = 0 notes: only make a transition between user mode and user program mode when the cpu is not accessing the flash memory. * 1 ram emulation possible * 2 this lsi transits to programmer mode by using the dedicated prom programmer. figure 19.2 flash memory state transitions table 19.1 differences between b oot mode and user program mode boot mode user program mode total erase yes yes block erase no yes programming control program * (2) (1) (2) (3) (1) erase/erase-verify (2) program/program-verify (3) emulation note: * to be provided by the user, in accordance with the recommended algorithm.
rev. 2.00, 09/04, page 552 of 720 flash memory this lsi ram host programming control program sci application program (old version) new application program flash memory this lsi ram host sci application program (old version) boot program area new application program flash memory this lsi ram host sci flash memory erase boot program new application program flash memory this lsi program execution state ram host sci new application program boot program programming control program 1. initial state the old program version or data remains written in the flash memory. the user should prepare the programming control program and new application program beforehand in the host. 2. programming control program transfer when boot mode is entered, the boot program in this lsi (originally incorporated in the chip) is started and the programming control program in the host is transferred to ram via sci communication. the boot program required for flash memory erasing is automatically transferred to the ram boot program area. 3. flash memory initialization the erase program in the boot program area (in ram) is executed, and the flash memory is initialized (to h'ff). in boot mode, total flash memory erasure is performed, without regard to blocks. 4. writing new application program the programming control program transferred from the host to ram is executed, and the new application program in the host is written into the flash memory. programming control program boot program boot program boot program area boot program area programming control program figure 19.3 boot mode
rev. 2.00, 09/04, page 553 of 720 flash memory this lsi ram host programming/ erase control program sci boot program new application program flash memory this lsi ram host sci new application program flash memory this lsi ram host sci flash memory erase boot program new application program flash memory this lsi program execution state ram host sci boot program boot program fwe assessment program application program (old version) new application program 1. initial state the fwe assessment program that confirms that user program mode has been entered, and the program that will transfer the programming/erase control program from flash memory to on-chip ram should be written into the flash memory by the user beforehand. the programming/erase control program should be prepared in the host or in the flash memory. 2. programming/erase control program transfer when user program mode is entered, user software confirms this fact, executes transfer program in the flash memory, and transfers the programming/erase control program to ram. 3. flash memory initialization the programming/erase program in ram is executed, and the flash memory is initialized (to h'ff). erasing can be performed in block units, but not in byte units. 4. writing new application program next, the new application program in the host is written into the erased flash memory blocks. do not write to unerased blocks. programming/ erase control program programming/ erase control program programming/ erase control program transfer program application program (old version) transfer program fwe assessment program fwe assessment program transfer program fwe assessment program transfer program figure 19.4 user program mode
rev. 2.00, 09/04, page 554 of 720 19.3 block configuration figure 19.5 shows the block configuration of 256-kbyte flash memory. the thick lines indicate erasing units, the narrow lines indicate programming units, and the values are addresses. the flash memory is divided into 64 kbytes (3 blocks), 32 kbytes (1 block), and 4 kbytes (8 blocks). erasing is performed in these units. programming is performed in 128-byte units starting from an address with lower eight bits h'00 or h'80. eb0 eb1 eb2 eb3 eb4 eb5 eb6 eb7 eb8 eb9 h'000000 h'000fff h'00007f h'004fff h'005fff h'001fff h'002fff h'003fff h'01ffff h'006fff h'007fff h'00ffff h'001000 h'002000 h'003000 h'004000 h'005000 h'006000 h'007000 h'008000 h'010000 eb10 h'02ffff h'020000 eb11 h'03ffff h'030000 programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes erase unit 4 kbytes erase unit 4 kbytes erase unit 4 kbytes erase unit 4 kbytes erase unit 4 kbytes erase unit 4 kbytes erase unit 4 kbytes erase unit 4 kbytes erase unit 32 kbytes erase unit 64 kbytes erase unit 64 kbytes erase unit 64 kbytes ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? figure 19.5 flash memory block configuration
rev. 2.00, 09/04, page 555 of 720 19.4 input/output pins the flash memory is controlled by means of the pins shown in table 19.2. table 19.2 pin configuration pin name i/o function res input reset fwp input flash program/erase protection by hardware md1 input sets this lsi's operating mode md0 input sets this lsi's operating mode txd3 (pa9) * output serial transmit data output rxd3 (pa8) * input serial receive data input note: * in boot mode, pa8 and pa9 pins are used as sci pins. 19.5 register descriptions the flash memory has the following registers. for details on register addresses and register states during each processing, see appendix a, internal i/o register. ? flash memory control register 1 (flmcr1) ? flash memory control register 2 (flmcr2) ? erase block register 1 (ebr1) ? erase block register 2 (ebr2) ? ram emulation register (ramer) 19.5.1 flash memory control register 1 (flmcr1) flmcr1 is a register that makes the flash memory change to program mode, program-verify mode, erase mode, or erase-verify mode. for details on register setting, see section 19.8, flash memory programming/erasing.
rev. 2.00, 09/04, page 556 of 720 bit bit name initial value r/w description 7 fwe 1/0 r flash write enable reflects the input level at the fwp pin. it is set to 1 when a low level is input to the fwp pin, and cleared to 0 when a high level is input. 6 swe 0 r/w software write enable when this bit is set to 1 while the fwe bit is 1, flash memory programming/erasing is enabled. when this bit is cleared to 0, other flmcr1 bits and all ebr1 and ebr2 bits cannot be set. 5 esu 0 r/w erase setup when this bit is set to 1 while the fwe and swe bits are 1, the flash memory changes to the erase setup state. when it is cleared to 0, the erase setup state is cancelled. 4 psu 0 r/w program setup when this bit is set to 1 while the fwe and swe bits are 1, the flash memory changes to the program setup state. when it is cleared to 0, the program setup state is cancelled. 3 ev 0 r/w erase-verify when this bit is set to 1 while the fwe and swe bits are 1, the flash memory changes to erase-verify mode. when it is cleared to 0, erase-verify mode is cancelled. 2 pv 0 r/w program-verify when this bit is set to 1 while the fwe and swe bits are 1, the flash memory changes to program-verify mode. when it is cleared to 0, program-verify mode is cancelled. 1 e 0 r/w erase when this bit is set to 1 while the fwe, swe and esu bits are 1, the flash memory changes to erase mode. when it is cleared to 0, erase mode is cancelled. 0 p 0 r/w program when this bit is set to 1 while the fwe, swe and psu bits are 1, the flash memory changes to program mode. when it is cleared to 0, program mode is cancelled.
rev. 2.00, 09/04, page 557 of 720 19.5.2 flash memory control register 2 (flmcr2) flmcr2 is a register that displays the st ate of flash memory programming/erasing. bit bit name initial value r/w description 7 fler 0 r indicates that an error has occurred during an operation on flash memory (programming or erasing). when flash memory goes to the error-prote ction state, fler is set to 1. see section 19.9.3, error protection, for details. 6 to 0 ? all 0 r reserved these bits are always read as 0. 19.5.3 erase block register 1 (ebr1) ebr1 specifies the flash memory erase block. ebr1 is initialized to h'00 when a high level is input to the fwp pin. it is also initialized to h'00, when the swe bit in flmcr1 is 0 regardless of value in the fwp pin. do not set more than one bit at a time in ebr1 and ebr2, as this will cause all the bits in ebr1 and ebr2 to be automatically cleared to 0. bit bit name initial value r/w description 7 eb7 0 r/w when this bit is set to 1, 4 kbytes of eb7 (h'007000 to h'007fff) are to be erased. 6 eb6 0 r/w when this bit is set to 1, 4 kbytes of eb6 (h'006000 to h'006fff) are to be erased. 5 eb5 0 r/w when this bit is set to 1, 4 kbytes of eb5 (h'005000 to h'005fff) are to be erased. 4 eb4 0 r/w when this bit is set to 1, 4 kbytes of eb4 (h'004000 to h'004fff) are to be erased. 3 eb3 0 r/w when this bit is set to 1, 4 kbytes of eb3 (h'003000 to h'003fff) are to be erased. 2 eb2 0 r/w when this bit is set to 1, 4 kbytes of eb2 (h'002000 to h'002fff) are to be erased. 1 eb1 0 r/w when this bit is set to 1, 4 kbytes of eb1 (h'001000 to h'001fff) are to be erased. 0 eb0 0 r/w when this bit is set to 1, 4 kbytes of eb0 (h'000000 to h'000fff) are to be erased.
rev. 2.00, 09/04, page 558 of 720 19.5.4 erase block register 2 (ebr2) ebr2 specifies the flash memory erase block. ebr2 is initialized to h'00 when a high level is input to the fwp pin. it is also initialized to h'00, when the swe bit in flmcr1 is 0 regardless of value in the fwp pin. do not set more than one bit at a time in ebr1 and ebr2, as this will cause all the bits in ebr1 and ebr2 to be automatically cleared to 0. bit bit name initial value r/w description 7 to 4 ? all 0 r reserved these bits are always read as 0 and should only be written with 0 3 eb11 0 r/w when this bit is set to 1, 64 kbytes of eb11 (h'030000 to h'03ffff) are to be erased. 2 eb10 0 r/w when this bit is set to 1, 64 kbytes of eb10 (h'020000 to h'02ffff) are to be erased. 1 eb9 0 r/w when this bit is set to 1, 64 kbytes of eb9 (h'010000 to h'01ffff) will be erased. 0 eb8 0 r/w when this bit is set to 1, 32 kbytes of eb8 (h'008000 to h'00ffff) will be erased. 19.5.5 ram emulation register (ramer) ramer specifies the area of flash memory to be overlapped with part of ram when emulating real-time flash memory programming. ramer settings should be made in user mode or user program mode. to ensure correct operation of the emulation function, the rom for which ram emulation is performed should not be accessed imme diately after this regist er has been modified. normal execution of an access immediately after register m odification is not guaranteed. bit bit name initial value r/w description 15 to 4 ? all 0 r reserved these bits are always read as 0. 3 rams 0 r/w ram select specifies selection or non-selection of flash memory emulation in ram. when rams = 1, the flash memory is overlapped with part of ram, and all flash memory blocks are program/erase-pr otected. when rams = 0, the ram emulation function is disabled.
rev. 2.00, 09/04, page 559 of 720 bit bit name initial value r/w description 2 1 0 ram2 ram1 ram0 0 0 0 r/w r/w r/w flash memory area selection when the rams bit is set to 1, these bits specify one of the following flash memory areas to be overlapped with part of ram. 000: h'00000000 to h'00000fff (eb0) 001: h'00001000 to h'00001fff (eb1) 010: h'00002000 to h'00002fff (eb2) 011: h'00003000 to h'00003fff (eb3) 100: h'00004000 to h'00004fff (eb4) 101: h'00005000 to h'00005fff (eb5) 110: h'00006000 to h'00006fff (eb6) 111: h'00007000 to h'00007fff (eb7) 19.6 on-board programming modes there are two modes for programming/erasing of the flash memory; boot mode, which enables on- board programming/erasing, and programmer mode, in which programming/erasing is performed with a prom programmer. on-board programming/erasing can also be performed in user program mode. at reset-start in reset mode, this lsi changes to a mode depending on the md pin settings and fwp pin setting, as shown in table 19.3. when changing to boot mode, the boot program bui lt into this lsi is initiated. the boot program transfers the programming control program from the externally connected host to on-chip ram via sci3. after erasing the entire flash memory, the programming control program is executed. this can be used for programming initial values in the on-board state or for a forcible return when programming/erasing can no longer be done in user program mode. in user program mode, individual blocks can be erased and programmed by branching to the user program/erase control program prepared by the user. table 19.3 setting on-board programming modes md1 md0 fwp lsi state after reset end 0 expanded mode 0 1 boot mode single-chip mode 0 expanded mode 1 1 0 user program mode single-chip mode
rev. 2.00, 09/04, page 560 of 720 19.6.1 boot mode table 19.4 shows the boot mode operations between reset end and branching to the programming control program. 1. when boot mode is used, the flash memory programming control program must be prepared in the host beforehand. prepare a programming control program in accordance with the description in section 19.8, flash memory programming/erasing. 2. the sci3 should be set to asynchronous mode, and the transfer format as follows: 8-bit data, 1 stop bit, and no parity. 3. when the boot program is initiated, the chip measures the low-level period of asynchronous sci communication data (h'00) transmitted continuously from the host. the chip then calculates the bit rate of transmission from the host, and adjusts the sci3 bit rate to match that of the host. the reset should end with the rxd pin high. the rxd and txd pins should be pulled up on the board if necessary. 4. after matching the bit rates, the chip transmits one h'00 byte to the host to indicate the completion of bit rate adjustment. the host should confirm that this adjustment end indication (h'00) has been received normally, and transmit one h'55 byte to the chip. if reception could not be performed normally, initia te boot mode again by a reset. depending on the host's transfer bit rate and system clock frequency of this lsi, there will be a discrepancy between the bit rates of the host and the chip. to operate the sci properly, set the host's transfer bit rate and system clock frequency of this lsi within the ranges listed in table 19.5. 5. in boot mode, a part of the on-chip ram area is used by the boot program. the area h'ffffd800 to h'ffffffff is the area to which the programming control program is transferred from th e host. the boot program area cannot be used until the ex ecution state in boot mode switches to the programming control program. 6. before branching to the programming control pr ogram, the chip terminat es transfer operations by sci3 (by clearing the re and te bits in scr to 0), however the adjusted bit rate value remains set in brr. therefore, the programming co ntrol program can still use it for transfer of write data or verify data with the host. the tx d pin is high. the contents of the cpu general registers are undefined immediately after br anching to the programming control program. these registers must be initialized at the beginni ng of the programming control program, as the stack pointer (sp), in particular, is used implicitly in subroutine calls, etc. 7. boot mode can be cleared by a reset. end the reset after driving the reset pin low, waiting at least 20 states, and then setting the mode (md) pins. boot mode is also cleared when a wdt overflow reset occurs. 8. do not change the md pin input levels in boot mode. 9. all interrupts are disabled during programming or erasing of the flash memory.
rev. 2.00, 09/04, page 561 of 720 table 19.4 boot mode operation item host operation communications contents lsi operation boot mode start branches to boot program at reset-start. processing contents processing contents bit rate adjustment continuously transmits data h'00 at specified bit rate. h'00, h'00 ...... h'00 h'00 h'55  measures low-level period of receive data h'00.  calculates bit rate and sets it in brr of sci3.  transmits data h'00 to host as adjustment end indication. transmits data h'aa to host when data h'55 is received. transmits data h'55 when data h'00 is received error-free. transmits number of bytes (n) of programming control program to be transferred as 2-byte data (lower byte following upper byte) receives data h'aa. transmits 1-byte of programming control program (repeated for n times) receives data h'aa. transfer of programming control program flash memory erase boot program initiation echobacks the 2-byte data received to host. branches to programming control program transferred to on-chip ram and starts execution. echobacks received data to host and also transfers it to ram (repeated for n times) checks flash memory data, erases all flash memory blocks in case of written data existing, and transmits data h'aa to host. (if erase could not be done, transmits data h'ff to host and aborts operation.) upper byte and lower byte h'xx h'aa echoback echoback h'ff h'aa boot program erase error table 19.5 peripheral clock (p ) frequencies for which automatic adjustment of lsi bit rate is possible host bit rate peripheral cl ock frequency range of lsi 9,600 bps 4 to 40 mhz 19,200 bps 8 to 40 mhz
rev. 2.00, 09/04, page 562 of 720 19.6.2 programming/erasing in user program mode on-board programming/erasing of an individual flash memory block can also be performed in user program mode by branching to a user program/erase control program. the user must set branching conditions and provide on-board means of supplying programming data. the flash memory must contain the user program/erase control program or a program that provides the user program/erase control program from external memory. as the flash memory itself cannot be read during programming/erasing, transfer the user program/erase control program to on-chip ram or external memory. figure 19.6 shows a sample procedure for programming/erasing in user program mode. prepare a user program/erase control progra m in accordance with the description in section 19.8, flash memory programming/erasing. ye s no program/erase? transfer user program/erase control program to ram reset-start branch to user program/erase control program in ram execute user program/erase control program (flash memory rewrite) branch to flash memory application program branch to flash memory application program fwp = low * fwp = high note: * do not constantly apply a low level to the fwp pin. only apply a low level to the fwp pin when programming or erasing the flash memory. to prevent excessive programming or excessive erasing, while a low level is being applied to the fwp pin, activate the watchdog timer in case of handling cpu runaways. figure 19.6 programming/erasing fl owchart example in user program mode
rev. 2.00, 09/04, page 563 of 720 19.7 flash memory emulation in ram a setting in the ram emulation register (ramer) enables part of ram to overlap with the flash memory area so that data to be written to flas h memory can be emulated in ram in real time. emulation can be performed in user mode or user program mode. figure 19.7 shows an example of emulation of real-time flash memory programming. 1. set ramer to overlap part of ram with the area for which real-time programming is required. 2. emulation is performed using the overlapped ram. 3. after the program data has been confirmed, the rams bit is cleared, thus releasing the ram overlap. 4. the data written in the overlapped ram is written into the flash memory area. set ramer write tuning data to overlapped ram execute application program tuning ok? clear ramer write to flash memory emulation block no ye s start of emulation program end of emulation program figure 19.7 flowchart for flash memory emulation in ram
rev. 2.00, 09/04, page 564 of 720 figure 19.8 shows a sample procedure for flash memory block area overlapping. 1. the ram area to be overlapped is fixed at a 4-kbyte area in the range h'ffffd000 to h'ffffdfff. 2. the flash memory area to be overlapped is selected by ramer from a 4-kbyte area of the eb0 to eb7 blocks. 3. the overlapped ram area can be accessed fr om both the flash memory addresses and ram addresses. 4. when the rams bit in ramer is set to 1, program/erase protection is enabled for all flash memory blocks (emulation protection). in this state, setting the p or e bit in flmcr1 to 1 does not cause a transition to program mode or erase mode. 5. a ram area cannot be erased by execu tion of software in accordance with the erase algorithm. 6. block area eb0 contains the vector table. when performing ram emulation, the vector table is needed in the overlapped ram. eb0 h'00000 h'01000 h'02000 h'03000 h'04000 h'05000 h'06000 h'07000 h'08000 h'3ffff eb1 eb2 eb3 eb4 eb5 eb6 eb7 eb8 to eb11 h'ffffd000 h'ffffdfff h'ffffffff this area can be accessed from both the flash memory addresses and ram addresses. flash memory on-chip ram figure 19.8 example of ra m overlap operation (ram[2:0] = b'000)
rev. 2.00, 09/04, page 565 of 720 19.8 flash memory programming/erasing a software method using the cpu is employed to program and erase the flash memory in on- board programming modes. depending on the flmcr1 and flmcr2 settings, the flash memory operates in one of the following four modes: program mode, program-verify mode, erase mode, and erase-verify mode. the programming control program in boot mode and the user program/erase control program in user program mode use these operating modes in combination to perform programming/erasing. flash memory programming and erasing should be performed in accordance with the descriptions in section 19.8 .1, program/program-veri fy mode and section 19.8.2, erase/erase-veri fy mode, respectively. 19.8.1 program/program-verify mode when writing data or programs to the flash memory, the program/program-verify flowchart shown in figure 19.9 should be followed. performing programming operations according to this flowchart will enable data or programs to be written to the flash memory without subjecting the chip to voltage stress or sacrificing program data reliability. 1. programming must be done to an empty address. do not reprogram an address to which programming has already been performed. 2. programming should be carried out 128 bytes at a time. a 128-byte data transfer must be performed even if writing fewer than 128 bytes. in this case, h'ff data must be written to the extra addresses. 3. prepare the following data storage areas in ram: a 128-byte programming data area, a 128- byte reprogramming data area, and a 128-byte additional-programming data area. perform reprogramming data computation and additional programming data computation according to figure 19.9. 4. consecutively transfer 128 bytes of data in byte units from the reprogramming data area or additional-programming data area to the flas h memory. the program address and 128-byte data are latched in the flash memory. the lower 8 bits of the start addres s in the flash memory destination area must be h'00 or h'80. 5. the time during which the p bit is set to 1 is the programming time. figure 19.9 shows the allowable programming time. 6. the watchdog timer (wdt) is set to prevent overprogramming due to program runaway, etc. an overflow cycle of approximately 6.6 ms is allowed. 7. for a dummy write to a verify address, write 1- byte data h'ff to an address to be read. verify data can be read in longwords from the address to which a dummy write was performed. 8. the number of repetitions of the program/program-verify sequence to the same bit should not exceed the maximum number of programming (n).
rev. 2.00, 09/04, page 566 of 720 start end sub 1 2 3 4 5 6 7 8 9 10 11 12 13 998 999 1000 t sp 30 t sp 30 t sp 30 t sp 30 t sp 30 t sp 30 t sp 200 t sp 200 t sp 200 t sp 200 t sp 200 t sp 200 t sp 200 t sp 200 t sp 200 t sp 200 ng ng ng ng ok ok ok * 2 * 7 * 7 * 4 * 7 * 7 * 5 * 7 * 7 * 1 * 4 * 3 * 7 * 7 * 7 * 1 * 4 ok ng ok ng ok ram end of programming set swe bit in flmcr1 start of programming wait (t sswe ) s n = 1 m = 0 wait (t spv ) s wait (t spvr ) s wait (t cpv ) s apply write pulse (tsp30 or tsp200) sub-routine-call set pv bit in flmcr1 h'ff dummy write to verify address read verify data write data = verify data? transfer reprogram data to reprogram data area reprogram data computation transfer additional-programming data to additional-programming data area additional-programming data computation clear pv bit in flmcr1 clear swe bit in flmcr1 m = 1 reprogram see note * 6 for pulse width m = 0 ? increment address programming failure clear swe bit in flmcr1 wait (t cswe ) s 6 n? 6 n ? wait (t cswe ) s n n? n n + 1 store 128-byte program data in program data area and reprogram data area apply write pulse (tsp10) (additional programming) 128-byte data verification completed? successively write 128-byte data from additional- programming data area in ram to flash memory perform programming in the erased state. do not perform additional programming on previously programmed addresses. original data (d) verify data (v) reprogram data (x) comments programming completed still in erased state; no action programming incomplete; reprogram reprogram data computation table reprogram data (x') verify data (v) additional- programming data (y) 1 1 1 1 0 1 0 0 0 0 1 1 comments additional programming to be executed additional programming not to be executed additional programming not to be executed additional programming not to be executed 0 1 1 1 0 1 0 1 0 0 1 1 additional-programming data computation table notes: * 1 data transfer is performed by byte transfer. the lower 8 bits of the start address to be written to must be h'00 or h'80. a 128-byte data transfer must be performed even if writing fewer than 128 bytes; in this case, h'ff data must be written to t he extra addresses. * 2 verify data is read in 32-bit (longword) units. * 3 reprogram data is determined by the operation shown in the table below (comparison between the data stored in the program dat a area and the verify data). bits for which the reprogram data is 0 are programmed in the next reprogramming loop. therefore, even bits for which programming has bee n completed will be subjected to programming once again if the subsequent verify operation ends in failure. * 4 a 128-byte area for the storage of programming data, a 128-byte area for the storage of reprogramming data, and a 128-byte ar ea for the storage of additional- programming data must be provided in ram. the contents of the reprogram data area and additional-program data area are modifie d as programming proceeds. * 5 a write pulse of 30 s or 200 s is applied according to the progress of the programming operation. see note 6 for details of the pulse widths. when writing o f additional-programming data is executed, a 10 s write pulse should be applied. reprogram data x' means reprogram data when the write pulse is applied. program data storage area (128 bytes) reprogram data storage area (128 bytes) additional-programming data storage area (128 bytes) number of writes n note * 6: write pulse width write time (tsp) s * use a t sp 10 write pulse for additional programming. write pulse application subroutine apply write pulse set psu bit in flmcr1 enable wdt disable wdt wait (t spsu ) s set p bit in flmcr1 wait (tsp10, tsp30, or tsp200) s clear p bit in flmcr1 wait (t cp ) s clear psu bit in flmcr1 wait (t cpsu ) s start of programming end of programming * 7 successively write 128-byte data from reprogram data area in ram to flash memory sub-routine-call figure 19.9 program/pr ogram-verify flowchart
rev. 2.00, 09/04, page 567 of 720 19.8.2 erase/erase-verify mode when erasing flash memory, the erase/erase-veri fy flowchart shown in figure 19.10 should be followed. 1. prewriting (setting erase block data to all 0s) is not necessary. 2. erasing is performed in block units. make only a single-bit specification in the erase block register 1 (ebr1) and the erase block register 2 (ebr2). to erase multiple blocks, each block must be erased in turn. 3. the time during which the e bit is set to 1 is the flash memory erase time. 4. the watchdog timer (wdt) is set to prevent overerasing due to prog ram runaway, etc. an overflow cycle of approximately 19.8 ms is allowed. 5. for a dummy write to a verify address, write 1- byte data h'ff to the read address. verify data can be read in longwords fr om the address to which a dummy write was performed. 6. if the read data is not erased successfully, se t erase mode again, and repeat the erase/erase- verify sequence as before. the number of repetit ions of the erase/erase-verify sequence should not exceed the maximum number of erasing (n). 19.8.3 interrupt handling when pr ogramming/erasing flash memory all interrupts, including the nmi interrupt, are disabled while flash memory is being programmed or erased, or while the boot program is executing, for the following three reasons: 1. an interrupt during programming/erasing may cause a violation of the programming or erasing algorithm, with the result that normal operation cannot be assured. 2. if an interrupt exception handling starts before the vector address is written or during programming/erasing, a correct vector cannot be fetched and the cpu malfunctions. 3. if an interrupt occurs during boot program execution, normal boot mode sequence cannot be carried out.
rev. 2.00, 09/04, page 568 of 720 no no ye s ye s ye s no no ye s * 1 * 3 * 2 * 4 erase start set ebr1 and ebr2 enable wdt disable wdt read verify data increment address verify data = all 1s? last address of block? all erase block erased? set block start address as verify address h'ff dummy write to verify address swe bit 1 n 1 esu bit 1 e bit 1 wait (t sswe ) s wait (t sesu ) e bit 0 ev bit 1 wait (t se ) esu bit 0 wait (t ce ) wait (t cesu ) wait (t sev ) ev bit 0 n n + 1 wait (t cev ) swe bit 0 wait (t cswe ) ev bit 0 n n? wait (t cev ) swe bit 0 wait (t cswe ) erase failure end of erasing wait (t sevr ) notes: * 1 prewriting (setting erase block data to all 0s) is not necessary. * 2 verify data is read in 32-bit (longword) units. * 3 make only a single-bit specification in the erase block register 1 (ebr1) and the erase block register 2 (ebr2). * 4 erasing is performed in block units. to erase multiple blocks, each block must be erased in turn. figure 19.10 erase/erase-verify flowchart
rev. 2.00, 09/04, page 569 of 720 19.9 program/erase protection there are three kinds of flash memory program/erase protection; hardware protection, software protection, and error protection. 19.9.1 hardware protection hardware protection refers to a state in which programming/erasing of flash memory is forcibly disabled or aborted. flash memory control register 1 (flmcr1), flash memory control register 2 (flmcr2), erase block register 1 (ebr1), and erase block register 2 (ebr2) are initialized protect function item description program erase fwp pin protect when a high level is input to the fwp pin, flmcr1, ebr 1, and ebr 2 are initialized, and the program/erase protection state is entered. yes yes reset/standby protect in the reset state (including the reset state when the wdt overflows) and standby mode, flmcr1, ebr 1, and ebr 2 are initialized, and the program/erase protection state is entered. in a reset via the res pin, the reset state is not entered unless the res pin is held low until oscillation stabilizes after powering on. in the case of a reset during operation, hold the res pin low for the res pulse width specified in the ac characteristics section. yes yes
rev. 2.00, 09/04, page 570 of 720 19.9.2 software protection software protection can be implemented against programming/erasing of all flash memory blocks by clearing the swe bit in flmcr1. when software protection is in effect, setting the p or e bit in flmcr1 does not cause a transition to program mode or erase mode. by setting the erase block register 1 (ebr1), erase protection can be set for individual blocks. when ebr1 is set to h'00, erase protection is set for all blocks. protect function item description program erase swe bit protect when the swe bit in flmcr1 is cleared to 0, all blocks are program/e rase-protected. (this setting should be carried out in on-chip ram or external memory.) yes yes block protect by setting the erase block register 1 (ebr1) and the erase block register 2 (ebr2), erase protection can be set for individual blocks. when both ebr1 and ebr2 are set to h'00, erase protection is set for all blocks. ? yes emulation protect when the rams bit in ramer is set to 1, all blocks are program/erase-protected. yes yes 19.9.3 error protection in error protection, an error is detected when cpu runaway occurs during flash memory programming/erasing, or operation is not performed in accordance with the program/erase algorithm, and the prog ram/erase operation is forcibly ab orted. aborting the program/erase operation prevents damage to the flash memory due to overprogramming or overerasing. when the following errors are de tected during programming/eras ing of flash memory, the fler bit in flmcr2 is set to 1, and the error protection state is entered. ? when the flash memory is read during programming/erasing (including vector read and instruction fetch) ? immediately after exception handling (excluding a reset) during programming/erasing ? when a sleep instruction is executed during programming/erasing the flmcr1, flmcr2, ebr1, and ebr2 settings ar e retained, however pr ogram mode or erase mode is forcibly aborted at the point when the error is detected. program mode or erase mode cannot be re-entered by re-setting the p or e bit. however, pv and ev bit settings are retained, and a transition can be made to verify mode. th e error protection state can be cancelled by the power-on reset only.
rev. 2.00, 09/04, page 571 of 720 19.10 prom programmer mode in prom programmer mode, a prom programmer can be used to perform programming/erasing via a socket adapter, just as for a discrete flash memory. use a prom programmer that supports the renesas 256-kbyte flash memory on-chip mcu device type (fztat256v3a). 19.11 notes on use ? setting module standby mode for flash memory, this module can be disabled/enabled by the module standby control register. flash memory operation is enabled for the initial value. accessing flash memory is disabled by setting module standby mode. for more information, see section 24, power-down modes. 19.12 notes when converting the f-ztat versions to the mask-rom versions please note the following when converting the f-ztat versions to the mask-rom versions, with using the f-ztat application software. in the mask-rom version, addresses of the flash memory registers (see appendix a.1, register addresses (order of address)) re turn undefined value if read. when the f-ztat application software is used in the mask-rom versions, the fwp pin level cannot be determined. when converting the program, make sure the reprogramming (erasing/programming) part of the flash memory and the ram emulation part not to be initiated. in the mask-rom versions, boot mode pin setting should not be performed. note: this difference applies to all the f-ztat versions and all the mask-rom versions that have different rom size. 19.13 notes on flash memory programming and erasing precautions concerning the use of on-board programming mode, the ram emulation function, and programmer mode ar e summarized below. use the specified voltages and ti ming for programming and erasing: appling excessive voltage beyond the specification can perman ently damage the device. use an eprom programmer that supports the renesas' microcomputer device having on-chip 256-kbyte flash memory. use only the specified socket adapte r, otherwise a serious damage may occur. powering on and off (see figures 19.11 to 19.13): do not apply a low level to the fwp pin until v cc has been stabilized. also, drive the fwp pin high before turning off v cc . if v cc is to be
rev. 2.00, 09/04, page 572 of 720 applied or disconnected, fix the fwp pin level at v cc and place the flash memory in the hardware protection state in advance. conditions for this power-on and power-off timing should also be applied in the event of a power failure and subsequent recovery. fwp application/disconnection (see figures 19.11 to 19.13): if v cc is on or off while low level is applied to fwp pin, a voltage surge from low level on the reset pin may cause unintentional programming or erasing of flash memory. applying voltage to fwp should be carried out while mcu operation is in a stable condition. if mcu operation is not stable, fix the fwp pin high and set the protection state. the following points mu st be observed concerning fwp application and disconnection to prevent unintentional programming or erasing of flash memory: ? apply voltage to fwp while the v cc voltage is stable enough to satisfy the specification voltage range. ? in boot mode, apply voltage to fwp or disconnect it during a reset. ? prior to applying voltage while fwp pin is in low level in boot mode, ensure that the reset pin level is surely kept low despite the applying voltage is rising to v cc . note that in a case where ics for reset are used, the voltage leve l of reset pin can transiently exceed 1/2 v cc while v cc is rising. ? in user program mode, fwp can be switched between high and low level regardless of the reset state. fwp input can also be switched du ring execution of a program in flash memory. ? apply voltage to fwp while programs are not running away. ? disconnect fwp only wh en the swe, esu, psu, ev, pv, p, and e bits in flmcr1 are cleared. make sure that the sw e, esu, psu, ev, pv, p, and e bits are not set by mistake when applying voltage to fwp pin or disconnecting. do not apply a constant low level to the fwp pin: if a program runs away while low level is applied to fwp pin, incorrect programming or erasing may occur. apply a low level to the fwp pin only when programming or erasing flash memory. avoid creating a system configuration in which a low level is constantly applied to the fw p pin. also, while a low level is applied to the fwp pin, the watchdog timer should be activ ated to prevent excess programming or excess erasing due to program runaway, etc. use the recommended algorithm when pr ogramming and erasing flash memory: the recommended algorithm enables programming and erasing to be carried out without subjecting the device to voltage stress or sacrificing program data reliability. when setting the p or e bit in flmcr1, the watchdog timer should be set before hand as a precaution against program runaway, etc. do not set or clear the swe bit during execution of a program in flash memory: wait for at least 100 s after clearing the swe bit before execu ting a program or reading data in flash memory. when the swe bit is set, data in flas h memory can be rewritten. access flash memory only for verify operations (verification during programming/erasing). also, do not clear the swe
rev. 2.00, 09/04, page 573 of 720 bit during programming, erasing, or verifying. similarly, when using the ram emulation function while a low level is being input to the fwp pin, the swe bit must be cleared before executing a program or reading data in flash memory. however, the ram area overlapping flash memory space can be read and written to regardless of whether the swe bit is set or cleared. do not use interrupts while flash memory is being programmed or erased: all interrupt requests, including nmi, should be disabled during fwp application to give priority to program/erase operations. do not perform additional programming. erase the memory before reprogramming: in on- board programming, perform only one programming operation on a 128-byte programming unit block. in programmer mode, too, perform only one programming operation on a 128-byte programming unit block. programming should be carried out with the entire programming unit block erased. before programming, check that the chip is correctly mounted in the eprom programmer: overcurrent damage to the device can result if the index marks on the eprom programmer socket, socket adapter, and ch ip are not correctly aligned. do not touch the socket adapt er or chip during programming: casual contact with either of these by hand or something while programming can generate a transient noise on the fwp and reset pins or cause incorrect programming or erasing due to bad electrical contact. reset the flash memory before turning on the power: if v cc is applied to the reset pin while in high state, mode signals are not correctly downloaded, causing mcu's runaway. in a case where fwp pin is in low state, incorr ect programming or erasing can occur. apply the reset signal while swe is low to reset the flash memory during its operation: the reset signal is applied at least 100 s after the swe bit has been cleard. comply with power-on procedure de signated by the programmer maker: when executing an on-board writing with a programmer, incorrect programming or erasing may occur unless the power-on procedure designated by the programmer makers is applied.
rev. 2.00, 09/04, page 574 of 720 t mds * 3 t osc1 t mds * 3 swe cleared swe set min 0 s wait time: t sswe programming/erasing possible wait time: 100 s ck vcc fwp md3 to md0 * 1 res s we bi t period durin g which flash memory access is prohibite d (t sswe : wait time after setting swe bit) * 2 period during which flash memory can be programmed (execution of program if flash memory prohibited, and data reads other than verify operations prohibited) notes: 1. 2. 3. except when switching modes, the level of the mode pins (md3 to md0) must be fixed until power-off by pulling the pins up or down. see section 25.5, flash memory characteristics in electrical characteristics. see section 25.3.3, control signal timing in electrical characteristics. t mds * 3 min 0 s figure 19.11 power-on /off timing (boot mode)
rev. 2.00, 09/04, page 575 of 720 t osc1 t mds * 3 swe cleared swe set min 0 s wait time: t sswe programming/erasing possible wait time: 100 s ck vcc fwp md3 to md0 * 1 res s we bi t period durin g which flash memory access is prohibite d (t sswe : wait time after setting swe bit) * 2 period during which flash memory can be programmed (execution of program if flash memory prohibited, and data reads other than verify operations prohibited) notes: 1. 2. 3. except when switching modes, the level of the mode pins (md3 to md0) must be fixed until power-off by pulling the pins up or down. see section 25.5, flash memory characteristics in electrical characteristics. see section 25.3.3, control signal timing in electrical characteristics. figure 19.12 pow er-on/off timing (user program mode)
rev. 2.00, 09/04, page 576 of 720 t osc1 t mds * 2 min 0 s ck vcc fwp md3 to md0 res swe bit period during which flash memory access is prohibited (t sswe : wait time after setting swe bit) * 3 period during which flash memory can be programmed (execution of program in flash memory prohibited, and data reads other than verify operations prohibited) t mds * 2 t mds * 2 t re s w mode change * 1 mode change * 1 boot mode user mode user mode user program mode user program mode * 4 * 4 * 4 * 4 swe cleared swe set wait time: t sswe programming/erasing possible wait time: t sswe programming/erasing possible wait time: t sswe programming/erasing possible wait time: t sswe programming/erasing possible notes: 1. 2. 3. 4. when entering boot mode or making a transition from boot mode to another mode, mode switching must be carried out by means of res input. see section 25.3.3, control signal timing in electrical characteristics. see section 25.5, flash memory characteristics in electrical characteristics. wait time: 100 s. figure 19.13 mode transition timing (example: boot mode user mode user program mode)
rev. 2.00, 09/04, page 577 of 720 section 20 mask rom this lsi is available with 128 kbytes of on-chip rom. the on-chip rom is connected to the cpu and data transfer controller (dtc) through a 32-bit data bus (figures 20.1). the cpu and dtc can access the on-chip rom in 8, 16 and 32-bit widths. data in the on-chip rom can always be accessed in one cycle. h'00000000 h'00000004 h'00000001 h'00000005 h'00000002 h'00000006 h'00000003 h'00000007 h'0001fffc h'0001fffd h'0001fffe h'0001ffff internal data bus (32 bits) on-chip rom figure 20.1 mask rom block diagram the operating mode determines whether the on-chip rom is valid or not. the operating mode is selected using mode-setting pins fwp and md3 to md0 as shown in table 3.1. if you are using the on-chip rom, select mode 2 or mode 3; if you are not, select mode 0 or mode 1. the on-chip rom is allocated to addresses h'00000000 to h'0001ffff. 20.1 notes on use ? setting module standby mode for mask rom, this module can be disabled/enabled by the module standby control register. mask rom operation is enabled for the initial va lue. accessing mask rom is disabled by setting module standby mode. for more information, see section 24, power-down modes.
rev. 2.00, 09/04, page 578 of 720
rev. 2.00, 09/04, page 579 of 720 section 21 ram the sh7047 group has an on-chip high-speed static ram. the on-chip ram is connected to the cpu, data transfer controller (dtc), and advanced user debugger (aud) by a 32-bit data bus, enabling 8, 16, or 32-bit width acces s to data in the on-chip ram. data in the on-chip ram can always be accessed in one cycle, providing high -speed access that makes this ram ideal for use as a program area, stack area, or data area. the c ontents of the on-chip ram are retained in both sleep and software standby modes. the on-chip ram can be enabled or disabled by means of the rame bit in the system control register (syscr). for details on the system c ontrol register (syscr), refer to section 24.2.2, system control register (syscr). product type type of rom ram capacity ram address flash memory 12 kbytes h'ffffd000 to h'ffffffff sh7047 mask rom 8 kbytes h'ffffe000 to h'ffffffff 21.1 usage note ? module standby mode setting ram can be enabled/disabled by the module standby control register. the initial value enables ram operation. ram access is di sabled by setting the module standby mode. for details, see section 24, power-down modes.
rev. 2.00, 09/04, page 580 of 720
rev. 2.00, 09/04, page 581 of 720 section 22 high-performance user debugging interface (h-udi) 22.1 overview the high-performance user deb ugging interface (h-udi) provides data transfer and interrupt request functions. the h-udi performs serial transfer by means of external signal control. 22.1.1 features the h-udi has the following features: ? five test signals (tck, tdi, tdo, tms, and trst ) ? tap controller ? two instructions ? bypass mode test mode conforming to ieee 1149.1 ? h-udi interrupt h-udi interrupt request to intc note: this lsi does not support test modes other than the bypass mode.
rev. 2.00, 09/04, page 582 of 720 22.1.2 block diagram figure 22.1 shows a block diagram of the h-udi. tap controller tck tms trst tdi tdo h-udi interrupt signal sdir: sdsr: sddrh: sddrl: sdbpr: mux decoder internal bus controller instruction register status register data register h data register l bypass register tck: tms: trst : tdi: tdo: test clock test mode select test reset test data input test data output peripheral bus sdbpr shift register sdir sdsr sddrh sddrl 16 figure 22.1 h-udi block diagram
rev. 2.00, 09/04, page 583 of 720 22.2 input/output pins table 22.1 shows the h-udi pin configuration. table 22.1 h-udi pins pin name abbreviation i/o function test clock tck input test clock input tck supplies an independent clock to the h-udi. as the clock input to tck is supplied directly to the h-udi, a clock waveform with a duty cycle close to 50% should be input (see section 25, electrical characteristics, for details). test mode select tms input test mode select input signal tms is sampled at the rising edge of tck. tms controls the internal stat e of the tap controller. test data input tdi input serial data input tdi performs serial input of instructions and data to h- udi registers. tdi is sampled at the rising edge of tck. test data output tdo output serial data output tdo performs serial output of instructions and data from h-udi registers. transfer is synchronized with tck. when no signal is being output, tdo goes to the high-impedance state. test reset trst input test reset input signal trst is used to initialize the h-udi asynchronously. 22.3 register description the h-udi has the following registers. for the regi ster addresses and register states in each operating mode, refer to appendix a, internal i/o register. ? instruction register (sdir) ? status register (sdsr) ? data register h (sddrh) ? data register l (sddrl) ? bypass register (sdbpr) instructions and data can be input to the instruc tion register (sdir) and data register (sddr) by serial transfer from the test data input pin (tdi). data from the status register (sdsr), and sddr can be output via the test data output pin (tdo). the bypass register (sdbpr) is a one-bit register
rev. 2.00, 09/04, page 584 of 720 that is connected to tdi and tdo in bypass mo de. except for sdbpr, all the registers can be accessed by the cpu. table 22.2 shows the kinds of serial transfer that can be used with each of the h-udi's registers. table 22.2 serial transfer characteristics of h-udi registers register serial input serial output sdir possible not possible sdsr not possible possible sddrh possible possible sddrl possible possible sdbpr possible possible 22.3.1 instruction register (sdir) the instruction register (sdir) is a 16-bit register that can be read, but not written to, by the cpu. h-udi instructions can be transferred to sdir by serial input from tdi. sdir can be initialized by the trst signal, but is not initialized in software standby mode. instructions transferred to sdir must be 4 bits in length. if an instructio n exceeding 4 bits is input, the last 4 bits of the serial data will be stored in sdir. bit bit name initial value r/w description 15 14 13 12 ts3 ts2 ts1 ts0 1 1 1 1 r r r r test instruction bits the instruction configurati on is shown in the table below. 0xxx: setting prohibited 100x: setting prohibited 1010: h-udi interrupt 1011: setting prohibited 110x: setting prohibited 1110: setting prohibited 1111: bypass mode 11 to 0 ? all 0 r reserved these bits are always read as 0, and should only be written with 0. note: x: don't care
rev. 2.00, 09/04, page 585 of 720 22.3.2 status register (sdsr) the status register (sdsr) is a 16-bit register that can be read and written to by the cpu. the sdsr value can be output from tdo, but serial data cannot be written to sdsr via tdi. the sdtrf bit is output by means of a one-bit shift. in a two-bit shift, the sdtrf bit is output first, followed by a reserved bit. sdsr is initialized by trst signal input, but is not initialized in software standby mode. bit bit name initial value r/w description 15 to 12 ? all 0 r reserved these bits are always read as 0, and should only be written with 0. 11 ? 1 r reserved this bit is always read as 1, and should always be written with 1. 10 to 1 ? all 0 r reserved these bits are always read as 0, and should only be written with 0. 0 sdtrf 1 r/w serial data transfer control flag indicates whether h-udi registers can be accessed by the cpu. the sdtrf bit is initialized by the trst signal, but is not initialized by a reset or in software standby mode. 0: serial transfer to sddr has ended, and sddr can be accessed. 1: serial transfer to sddr is in progress.
rev. 2.00, 09/04, page 586 of 720 22.3.3 data register (sddr) the data register (sddr) comprises data register h (sddrh) and data register l (sddrl). sddrh and sddrl are 16-bit regist ers that can be read and writt en to by the cpu. sddr is connected to tdo and tdi for serial data tr ansfer to and from an external device. 32-bit data is input and output in serial data transfer. if data exceeding 32 bits is input, only the last 32 bits will be stored in sddr. serial data is input starting with the msb of sddr (bit 15 of sddrh), and output starting with the lsb (bit 0 of sddrl). sddr is not initialized by a reset, in hardware or software standby mode, or by the trst signal. the initial value of sddr is undefined. 22.3.4 bypass register (sdbpr) the bypass register (sdbpr) is a one-bit shift register. in bypass mode, sdbpr is connected to tdi and tdo, and this lsi is bypassed in a board test. sdbpr cannot be read or written to by the cpu.
rev. 2.00, 09/04, page 587 of 720 22.4 operation 22.4.1 h-udi interrupt when an h-udi interrupt instructio n is transferred to sdir via tdi, an interrupt is generated. data transfer can be controlled by means of the h-udi interrupt service routine. transfer can be performed by means of sddr. control of data input/output between an external device and the h-udi is performed by monitoring the sdtrf bit in sdsr externally and internally. internal sdtrf bit monitoring is carried out by having sdsr read by the cpu. the h-udi interrupt and serial tr ansfer procedure is as follows. 1. an instruction is input to sdir by serial tran sfer, and an h-udi interrupt request is generated. 2. after the h-udi interrupt request is issued, the sdtrf bit in sdsr is monitored externally. after output of sdtrf = 1 from tdo is observed, serial data is transferred to sddr. 3. on completion of the serial transfer to sddr, the sdtrf bit is cleared to 0, and sddr can be accessed by the cpu. after sddr has been accesse d, sddr serial transfer is enabled by setting the sdtrf bit in sdsr to 1. 4. serial data transfer between an external devi ce and the h-udi can be carried out by constantly monitoring the sdtrf bit in sdsr externally and internally. figures 22.2, 22.3, and 22.4 show the timing of data transfer between an external device and the h-udi.
rev. 2.00, 09/04, page 588 of 720 sdtrf (in sdsr) * 1 h-udi interrupt request serial data sdsr and sddr mux * 2 sddr access state input/ output sdtrf input shift enabled sddr sddr sdsr sdsr serial transfer (monitoring) instruc- tion 1 1 0 shift disabled sdsr shift shift cpu cpu notes: *1 sdtrf flag (in sdsr): indicates whether sddr access by the cpu or serial transfer data input/output to sddr is possible. 1 sddr is shift-enabled. do not access sddr until sdtrf = 0. 0 sddr is shift-disabled. sddr access by the cpu is enabled. conditions:  sdtrf = 1 ? when trst = 0 ? when the cpu writes 1 ? in bypass mode  sdtrf = 0 ? end of sddr shift access in serial transfer *2 sdsr/sddr (update-dr state) internal mux switchover timing  switchover from sdsr to sddr: on completion of serial transfer in which sdtrf = 1 is output from tdo  switchover from sddr to sdsr: on completion of serial transfer to sddr shift enabled figure 22.2 data input/output timing chart (1)
rev. 2.00, 09/04, page 589 of 720 tck tms tdi tdo trst test-logic-reset run-test/idle select-dr select-ir capture-ir shift-ir update-ir select-dr capture-dr shift-dr test-logic-reset run-test/idle exit1-dr update-dr ts0 ts3 sdtrf exit1-ir figure 22.3 data input/output timing chart (2) tck tms tdi tdo trst select-dr select-dr capture-dr shift-dr exit1-dr update-dr select-dr capture-dr shift-dr update-dr bit 0 sdtrf shift-dr capture-dr shift-dr select-dr update-dr capture-dr update-dr exit1-dr exit1-dr exit1-dr bit 31 bit 0 bit 31 sdtrf bit 0 bit 31 bit 0 bit 31 figure 22.4 data input/output timing chart (3)
rev. 2.00, 09/04, page 590 of 720 22.4.2 bypass mode bypass mode can be used to bypass this lsi in a boundary-scan test. bypass mode is entered by transferring b'1111 to sdir. in bypass mode, sdbpr is connected to tdi and tdo. 22.4.3 h-udi reset the h-udi can be reset as follows. ? by holding the trst signal at 0 ? when trst = 1, by inputting at least five tck clock cycles while tms = 1 ? by entering hardware standby mode ? by setting the pin function controller (pfc) not for the h-udi 22.5 usage notes ? the registers are not initialized in software standby mode. if trst is set to 0 in software standby mode, bypass mode will be entered. ? the frequency of tck must be lower than that of the peripheral module clock (p ). for details, see section 25, el ectrical characteristics. ? in serial data transfer, data input/output starts with the lsb. figure 22.5 shows serial data input/output. ? if the h-udi serial transfer sequence is disrupted, a trst reset must be executed. transfer should then be retried, regardless of the transfer operation. ? the tdo output timing is from the rise of tck. ? in the shift-ir state, the lower 2 bits of the output data from tdo (the ir status word) may not always be 01. ? if more than 32 bits are serially transferred, serial data exceeding 32 bits output from tdo should be ignored. ? ensure that the tdi pin is not in the high-impedance state.
rev. 2.00, 09/04, page 591 of 720 shift register sdir, sdsr, sddrh/sddrl 31 30 1 0 tdi tdo serial data input/output is in lsb-first order. figure 22.5 serial data input/output
rev. 2.00, 09/04, page 592 of 720
rev. 2.00, 09/04, page 593 of 720 section 23 advanced user debugger (aud) 23.1 overview this lsi has an on-chip advanced user debugger (aud). use of the aud simplifies the construction of a simple emulator , with functions such as acquis ition of branch trace data and monitoring/tuning of on-chip ram data. 23.1.1 features the aud has the fo llowing features: ? eight input/output pins ? data bus (audata3 to audata0) ? aud reset ( audrst ) ? aud sync signal ( audsync ) ? aud clock (audck) ? aud mode (audmd) ? two modes ? branch trace mode ? ram monitor mode
rev. 2.00, 09/04, page 594 of 720 23.1.2 block diagram figure 23.1 shows a block diagram of the aud. pc output circuit address buffer data buffer mode control internal bus bus controller peripheral module bus on-chip memory on-chip peripheral module cpu audata0 audata1 audata2 audata3 audrst audmd audck audsync figure 23.1 aud block diagram 23.2 pin configuration table 23.1 shows the aud's input/output pins. table 23.1 aud pins function name abbreviation branch trace mode ram monitor mode aud data audata3 to audata0 branch destination address output monitor address/data input/output aud reset audrst aud reset input aud reset input aud mode audmd mode select input (l) mode select input (h) aud clock audck sync clock ( /2) output sync clock input aud sync signal audsync data start position identification signal output data start position identification signal input
rev. 2.00, 09/04, page 595 of 720 23.2.1 pin descriptions pins used in both modes pin description audmd the mode is selected by changi ng the input level at this pin. low: branch trace mode high: ram monitor mode the input at this pin should be changed when audrst is low. audrst the aud's internal buffers and logic are initialized by inputting a low level to this pin. when this signal goes low, the aud enters the reset state and the aud's internal buffers and logic are reset. when audrst goes high again after the audmd level settles, the aud st arts operating in the selected mode.
rev. 2.00, 09/04, page 596 of 720 pin functions in branch trace mode pin description audck this pin outputs 1/2 the operating frequency ( /2). this is the clock for audata synchronization. audsync this pin indicates whether output from audata is valid. high: valid address data is not being output low: valid address is being output 1. when audsync is low when a program branch or interrupt branch occurs, the aud asserts audsync and outputs the branch destinat ion address. the output order is as follows: a3 to a0, a7 to a4, a11 to a8, a15 to a12, a19 to a16, a23 to a20, a27 to a24, a31 to a28. 2. when audsync is high when waiting for branch destination addr ess output, these pins constantly output 0011. when an branch occurs, audata3 and audata2 output 10, and audata1 and audata0 indicate whether a 4-, 8-, 16-, or 32-bit address is to be output by comparing the pr evious fully output address with the address output this time (see table below). audata1 and audata0 settings 00 address bits a31 to a4 match; 4 address bits a3 to a0 are to be output (i.e. output is performed once). 01 address bits a31 to a8 match; 8 address bits a3 to a0 and a7 to a4 are to be output (i.e. output is performed twice). 10 address bits a31 to a16 match; 16 address bits a3 to a0, a7 to a4, a11 to a8, and a15 to a12 are to be output (i.e. output is performed four times). audata3 to audata0 11 none of the above cases applies; 32 address bits a3 to a0, a7 to a4, a11 to a8, a15 to a12, a19 to a16, a23 to a20, a27 to a24, and a31 to a28 are to be output (i.e. output is performed eight times).
rev. 2.00, 09/04, page 597 of 720 pin functions in ram monitor mode pin description audck the external clock input pin. input the clock to be used for debugging to this pin. the input frequency must not exceed 1/4 the operating frequency. audsync do not assert this pin until a command is input to audata externally and the necessary data can be prepared. for deta ils, see the protocol description in the following. audata3 to audata0 when a command is input externally, data is output after ready transmit. output starts when audsync is negated. for details, see the protocol description in the following. 23.3 branch trace mode 23.3.1 overview in this mode, the branch destination address is ou tput when a branch occurs in the user program. branches may be caused by branch instruction execution or interrupt/exception processing, but no distinction is made between the two in this mode. 23.3.2 operation operation starts in branch trace mode when audrst is asserted, audmd is driven low, then audrst is negated. figure 23.2 shows an example of data output. while the user program is being executed without branches, the audata pins constantly output 0011 in synchronization with audck. when a branch occurs, after execution starts at the branch destination address in the pc, the previous fully output address (i.e. for which output was not interrupted by the occurrence of another branch) is compared with the current branch address, and depending on the result, audsync is asserted and the branch destination address is output after 1-clock output of 1000 (in the case of 4-bit output), 1001 (8-bit output), 1010 (16-bit output), or 1011 (32-bit output) from the audata pins. the initial value of the compared address is h'00000000. on completion of the cycle in which the address is output, audsync is negated and 0011 is simultaneously output from the audata pins. if another branch occurs during branch destination address output, the later branch has priority for output. in this case, audsync is negated and the audata pins output the address after outputting 10xx again (figure 23.3 shows an example of the output when consecutive branches
rev. 2.00, 09/04, page 598 of 720 occur). note that the compared address is the previous fully output address, and not an interrupted address (since the upper address of an interrupted address will be unknown). the interval from the start of execution at the branch destination address in the pc until the audata pins output 10xx is 1.5 or 2 audck cycles. audck 0011 0011 1011 a3 to a0 a7 to a4 a11 to a8 a15 to a12 a19 to a16 a23 to a20 a27 to a24 a31 to a28 0011 audsync audata [3:0] start of execution at branch destination address in pc figure 23.2 example of data output (32-bit output) audck 0011 0011 1011 a3 to a0 0011 0011 a3 to a0 a7 to a4 1010 a7 to a4 a11 to a8 a15 to a12 audsync audata [3:0] start of execution at branch destination address in pc (1) start of execution at branch destination address in pc (2) figure 23.3 example of output in case of successive branches 23.4 ram monitor mode 23.4.1 overview in this mode, all the modules connected to this lsi's internal or external bus can be read and written to, allowing ram monitoring and tuning to be carried out. when an address is written to audata externally, the data corresponding to that address is output. if an address and data are written to auda ta, the data is transferred to the address.
rev. 2.00, 09/04, page 599 of 720 23.4.2 communication protocol the aud latches the audata input when audsync is asserted. the following audata input format should be used. 0000 dir a3 to a0 a31 to a28 d3 to d0 dn to dn-3 input format spare bits (4 bits): b'0000 command fixed at 1 0: read 1: write 00: byte 01: word 10: longword bit 3 bit 2 bit 1 bit 0 . . . . . . . . . . . . address data (in case of write only) b write: n = 7 w write: n = 15 l write: n = 31 figure 23.4 audata input format 23.4.3 operation operation starts in ram monitor mode when audrst is asserted, audmd is driven high, then audrst is negated. figure 23.5 shows an example of a read oper ation, and figure 23.6 an example of a write operation. when audsync is asserted, input from the audata pins begins. when a command, address, or data (writing only) is input in the format shown in figure 23.4, execution of read/write access to the specified address is started. during internal execution, th e aud returns not ready (0000). when execution is completed, the ready flag (0001) is returned (figures 23.5 and 23.6). table 23.2 shows the ready flag format. in a read, data of the specified size is output when audsync is negated following detection of this flag (figure 23.5). if a command other than the above is input in dir, the aud treats this as a command error, disables processing, and sets bit 1 in the ready flag to 1. if a read/write operation initiated by the command specified in dir causes a bus error, the aud disables processing and sets bit 2 in the ready flag to 1 (figure 23.7).
rev. 2.00, 09/04, page 600 of 720 bus error conditions are shown below. 1. word access to ad dress 4n+1 or 4n+3 2. longword access to address 4n+1, 4n+2, or 4n+3 3. longword access to on-chip i/o 8-bit area 4. access the hcan2 area in longwords 5. access to external area in single-chip mode table 23.2 ready flag format bit 3 bit 2 bit 1 bit 0 fixed at 0 0: normal status 1: bus error 0: normal status 1: command error 0: not ready 1: ready audck not ready dir ready ready ready 0001 0001 0000 0000 1000 0001 a31 to a28 d7 to d4 d3 to d0 a3 to a0 audsync audatan input/output changeover input output figure 23.5 example of read operation (byte read) audck not ready ready dir ready ready 0000 0000 1110 0001 0001 0001 a31 to a28 d3 to d0 d31 to d28 a3 to a0 audatan input/output changeover input output audsync figure 23.6 example of writ e operation (longword write) audck not ready dir ready (bus error) ready (bus error) ready (bus error) 0101 0101 0000 0000 1010 0101 a31 to a28 a3 to a0 audsync audatan input/output changeover input output figure 23.7 example of e rror occurrence (longword read)
rev. 2.00, 09/04, page 601 of 720 23.5 usage notes 23.5.1 initialization the debugger's internal buffers and processing states are initialized in th e following cases: 1. in a power-on reset 2. in hardware standby mode 3. when audrst is driven low 4. when the audsrst bit in the syscr regist er is cleared to 0 (see section 24.2.2) 5. when the mstp3 bit in the mstcr2 re gister is set to 1 (see section 24.2.3) 23.5.2 operation in software standby mode the debugger is not initialized in software standby mode. however, since this lsi's internal operation halts in software standby mode: 1. when audmd is high (ram monitor mode), ready is not returned (not ready continues to be returned). however, when operating on an external input clock, the protocol continues. 2. when audmd is low (branch trace mode), operation stops. however, operation continues when software standby is released. 23.5.3 setting the pa15/ck/ poe6 / trst / back pin there is a debugging tool for generating the audck signal from the ck signal. see the manual of the debugging tool to set the pin function controller (pfc). 23.5.4 pin states 1. hstby/module standby audmd z audck z audsync z audata z 2. audrst = low-level input audmd input audck (1) audmd = high: input (2) audmd = low: high-level output audsync (1) audmd = high: input (2) audmd = low: high-level output audrst low-level input
rev. 2.00, 09/04, page 602 of 720 audata (1) audmd = high: input (2) audmd = low: high-level output 3. normal operation/software standby audsrst = 1 audmd input audck (1) audmd = high: input (2) audmd = low: output audsync (1) audmd = high: input (2) audmd = low: output audrst high-level input audata (1) audmd = high: input/output (2) audmd = low: output 23.5.5 aud activation procedures the following procedures should be followed. 1. select the aud as a pin function by specifying the pfc. 2. input the clock signal to the audck pin for three cycles at th e minimum keeping the audrst pin low. 3. set the aud reset bit (audsrst) in syscr to cancel the aud reset. setting the audrst pin to the low level and inputting the clock signal to the audck pin can be done before selection of the aud as a pin function.
rev. 2.00, 09/04, page 603 of 720 section 24 power-down modes in addition to the normal program execution state, this lsi has four power-down modes in which operation of the cpu and oscillator is halted and power dissipation is reduced. low-power operation can be achieved by individually cont rolling the cpu, on-chip peripheral functions, and so on. this lsi's power-down modes are as follows: ? sleep mode ? software standby mode ? hardware standby mode ? module standby mode sleep mode indicates the state of the cpu, and mo dule standby mode indicat es the state of the on- chip peripheral function (including the bus master other than the cpu). so me of these states can be combined. after a reset, the lsi is in normal-operation mode. table 24.1 lists internal oper ation states in each mode.
rev. 2.00, 09/04, page 604 of 720 table 24.1 internal operat ion states in each mode function normal operation sleep module standby software standby hardware standby system clock pulse generator functioning functioning functioning halted halted cpu instructions registers functioning halted (retained) functioning halted (retained) halted (undefined) nmi functioning functioning functioning functioning halted external interrupts irq3 to irq0 ubc functioning functioning halted (reset) halted (retained) halted (reset) peripheral functions dtc functioning functioning halted (reset) halted (reset) halted (reset) i/o port functioning functioning functioning retained high- impedance wdt functioning functioning functioning halted (retained) halted (reset) sci hcan2 a/d mtu cmt mmt functioning functioning halted (reset) halted (reset) halted (reset) h-udi functioning functioning retained retained halted (reset) aud rom functioning functioning halted (reset) halted (reset) halted (reset) ram functioning functioning retained retained retained notes: 1. "halted (retained)" means that the operat ion of the internal state is suspended, although internal register values are retained. 2. "halted (reset)" means that internal regi ster values and internal state are initialized. 3. in module standby mode, only modules for which a stop setting has been made are halted (reset or retained). 4. there are two types of on-chip peripheral module registers; ones which are initialized in software standby mode and module standby mode, and those not initialized those modes. for details, refer to appendix a.3, re gister states in each operating mode. 5. the port high-impedance bit (hiz) in sby cr sets the state of the i/o port in software standby mode. for details on the setting, re fer to section 24.2.1, standby control register (sbycr). for the state of pi ns, refer to appendix b, pin states.
rev. 2.00, 09/04, page 605 of 720 program-halted state program execution state sleep instruction sleep instruction external interrupt * hstby pin = high res pin = low hstby pin = low ssby = 0 ssby = 1 res pin = high : transition after exception processing : power-down mode reset state normal-operation mode (main clock) hardware standby mode software standby mode sleep mode (main clock) notes: * nmi and irq  when a transition is made between modes by means of an interrupt, the transition cannot be made on interrupt source generation alone. ensure that interrupt handling is performed after accepting the interrupt request.  in any state except hardware standby mode, a transition to the reset state occurs when res is driven low.  in any state, a transition to hardware standby mode occurs when hstby is driven low. figure 24.1 mode transition diagram
rev. 2.00, 09/04, page 606 of 720 24.1 input/output pins table 24.2 lists the pins relating to power-down mode. table 24.2 pin configuration pin name i/o function hstby input hardware standby input pin res input power-on reset input pin mres input manual reset input pin 24.2 register descriptions registers related to power down modes are shown below. for details on register addresses and register states during each process, refer to appendix a, internal i/o register. ? standby control register (sbycr) ? system control register (syscr) ? module standby control register 1 (mstcr1) ? module standby control register 2 (mstcr2)
rev. 2.00, 09/04, page 607 of 720 24.2.1 standby control register (sbycr) sbycr is an 8-bit readable/writable register that performs software standby mode control. bit bit name initial value r/w description 7 ssby 0 r/w software standby this bit specifies the transit ion mode after executing the sleep instruction. 0: shifts to sleep mode after the sleep instruction has been executed 1: shifts to software standby mode after the sleep instruction has been executed this bit cannot be set to 1 when the watchdog timer (wdt) is operating (when the tme bit in tcsr of the wdt is set to 1). when transferring to software standby mode, clear the tme bit to 0, stop the wdt, then set the ssby bit to 1. 6 hiz 0 r/w port high-impedance in software standby mode, this bit selects whether the pin state of the i/o port is retained or changed to high- impedance. 0: in software standby mode, the pin state is retained. 1: in software standby mode, the pin state is changed to high-impedance. the hiz bit cannot be set to 1 when the tem bit in tcsr of the wdt is set to 1. when changing the pin stat e of the i/o port to high- impedance, clear the tem bit to 0, then set the hiz bit to 1. 5 ? 0 r reserved this bit is always read as 0, and should always be written with 0. 4 to 1 ? all 1 r reserved these bits are always read as 1, and should always be written with 1. 0 irqel 1 r/w irq3 to irq0 enable irq interrupts are enabled to clear software standby mode. 0: software standby mode is cleared. 1: software standby mode is not cleared.
rev. 2.00, 09/04, page 608 of 720 24.2.2 system control register (syscr) syscr is an 8-bit readable/writable register that performs aud software reset control and enables/disables the acces s to the on-chip ram. bit bit name initial value r/w description 7, 6 ? all 1 r/w reserved these bits are always read as 1, and should always be written with 1. 5 to 2 ? all 0 r reserved these bits are always read as 0, and should always be written with 0. 1 audsrst 0 r/w aud software reset this bit controls the aud reset by software. when 0 is written to audsrst, aud module shifts to power-on reset state. 0: shifts to aud reset state. 1: clears the aud reset. 0 rame 1 r/w ram enable this bit enables/disables the on-chip ram. 0: on-chip ram disabled 1: on-chip ram enabled when this bit is cleared to 0, the access to the on-chip ram is disabled. in this case, an undefined value is returned when reading or fetching the data or instruction from the on-chip ram, and writing to the on- chip ram is ignored. when rame is cleared to 0 to disable the on-chip ram, an instruction to access the on-chip ram should not be set next to the instruction to write to syscr. if such an instruction is set, normal access is not guaranteed. when rame is set to 1 to enable the on-chip ram, an instruction to read syscr should be set next to the instruction to write to syscr. if an instruction to access the on-chip ram is set next to the instruction to write to syscr, normal access is not guaranteed.
rev. 2.00, 09/04, page 609 of 720 24.2.3 module standby control register 1 and 2 (mstcr1 and mstcr2) mstcr, comprising two 16-bit readable/writabl e registers, performs module standby mode control. setting a bit to 1, the corresponding module enters module standby mode, while clearing the bit to 0 clears the module standby mode. mstcr1 bit bit name initial value r/w description 15 to 12 ? all 1 r/w reserved these bits are always read as 1, and should always be written with 1. 11 mstp27 0 r/w on-chip ram 10 mstp26 0 r/w on-chip rom 9 mstp25 0 r/w 8 mstp24 0 r/w data transfer controller (dtc) set the identical value to mstp25 and mstp24, respectively. when setting module standby, write b'11, while clearing, write b'00. 7, 6 ? all 0 r reserved these bits are always read as 0, and should always be written with 0. 5 ? 1 r/w reserved this bit is always read as 1, and should always be written with 1. 4 mstp20 1 r/w serial communication interface 4 (sci_4) 3 mstp19 1 r/w serial communication interface 3 (sci_3) 2 mstp18 1 r/w serial communication interface 2 (sci_2) 1, 0 ? all 1 r/w reserved these bits are always read as 1, and should always be written with 1
rev. 2.00, 09/04, page 610 of 720 mstcr2 bit bit name initial value r/w description 15 ? 1 r/w reserved this bit is always read as 1, and should always be written with 1. 14 mstp14 1 r/w motor management timer (mmt) 13 mstp13 1 r/w multi-function timer pulse unit (mtu) 12 mstp12 1 r/w compare match timer (cmt) 11 ? 0 r 10 ? 0 r/w reserved these bits are always read as 0, and should always be written with 0. 9 mstp9 0 r/w renesas controller area network 2 (hcan2) 8 ? 0 r/w reserved this bit is always read as 0, and should always be written with 0. 7, 6 ? all 1 r/w reserved this bit is always read as 1, and should always be written with 1. 5 mstp5 1 r/w a/d converter (a/d1) 4 mstp4 1 r/w a/d converter (a/d0) 3 mstp3 0 r/w advanced user debugger (aud) * 2 mstp2 0 r/w renesas user debug interface (h-udi) * 1 ? 0 r reserved this bit is always read as 0, and should always be written with 0. 0 mstp0 0 r/w user break controller (ubc) note: * in e10a debugging mode (when dbgmd = low-level input), although this bit can be read and written, aud and h-udi are always operated regardless of set values.
rev. 2.00, 09/04, page 611 of 720 24.3 operation 24.3.1 sleep mode transition to sleep mode: if sleep instruction is executed while the ssby bit in sbycr = 0, the cpu enters sleep mode. in sleep mode, cpu operation stops, however the contents of the cpu's internal registers are retained. peri pheral functions except the cpu do not stop. in sleep mode, data should not be accessed by the dtc or aud. clearing sleep mode: sleep mode is cleared by the conditions below. ? clearing by the power-on reset when the res pin is driven low, the cpu enters the reset state. when the res pin is driven high after the elapse of the specified reset in put period, the cpu starts the reset exception handling. when an internal power-on reset by wd t occurs, sleep mode is also cleared. ? clearing by the manual reset when the mres pin is driven low while the res pin is high, the cpu shifts to the manual reset state and thus sl eep mode is cleared. when an internal manual reset by wdt occurs, sleep mode is also cleared. ? clearing by the hstby pin when the hstby pin is driven low, the cpu shifts to hardware standby mode. 24.3.2 software standby mode transition to software standby mode: a transition is made to software standby mode if the sleep instruction is executed while the ssby bit in sbycr is set to 1. in this mode, the cpu, on-chip peripheral functions, and the oscillator, all stop. however, the contents of the cpu's internal regi sters and on-chip ram data are retained as long as the specified voltage is supplied. there are two types of on-chip peripheral module registers; ones which are initialized by software standby mode, and those not initialized by that mode. for details, refer to appendix a.3, register states in each opera ting mode. the port high-impedance bit (hiz) in sbycr sets the state of the i/o port either to "retained" or "high-impedance". for the state of pins, refer to appendix b, pin states. in software standby mode, the oscillator stops and thus power consumption is significantly reduced.
rev. 2.00, 09/04, page 612 of 720 clearing software standby mode: software standby mode is cleared by the condition below. ? clearing by the nmi interrupt input when the falling edge or rising edge of the nmi pin (selected by the nmi edge select bit (nmie) in icr1 of the interrupt controller (intc)) is detected, clock oscillation is started. this clock pulse is supplied only to the watchdog timer (wdt). after the elapse of the time set in the clock select bits (cks2 to cks0) in tcsr of the wdt before the transition to software standby mode, the wdt overflow occurs. since this overflow indicates that the clock has been stabilized, clock pulse will be supplied to the entire chip after this overflow. software standby mode is thus cleared and the nmi exception handling is started. when clearing software standby mode by the nmi interrupt, set cks2 to cks0 bits so that the wdt overflow period will be longer than the oscillation stabilization time. when software standby mode is cleared by th e falling edge of the nmi pin, the nmi pin should be high when the cpu enters software standby mode (when the clock pulse stops) and should be low when the cpu returns from standby mode (when the clock is initiated after the oscillation stabilization). when software standby mode is cleared by the rising edge of the nmi pin, the nmi pin should be low when the cpu enters software standby mode (when the clock pulse stops) and should be high when the cpu returns from software standby mode (when the clock is initiated after the oscillation stabilization). ? clearing by the res pin when the res pin is driven low, clock oscillation is started. at the same time as clock oscillation is started, clock pulse is supplied to the entire chip. ensure that the res pin is held low until clock oscillation stabilizes. when the res pin is driven high, the cpu starts the reset exception handling. ? clearing by the irq interrupt input when the irqel bit in the standby control register (sbycr) is set to 1 and when the falling edge or rising edge of the irq pin (selected by the irq3s to irq0s bits in icr1 of the interrupt controller (intc) and the irq3es[1:0] to irq0es[1:0] bits in icr2) is detected, clock oscillation is started.* this clock pulse is supplied only to the watchdog timer (wdt). the irq interrupt priority level should be higher than the interrupt mask level set in the status register (sr) of the cpu before the transition to software standby mode. after the elapse of the time set in the clock select bits (cks2 to cks0) in tcsr of the wdt before the transition to software standby mode, the wdt overflow occurs. since this overflow indicates that the clock has been stabilized, clock pulse will be supplied to the entire chip after this overflow. software standby mode is thus cleared and the irq exception handling is started. when clearing software standby mode by the irq interrupt, set cks2 to cks0 bits so that the wdt overflow period will be longer than the oscillation stabilization time.
rev. 2.00, 09/04, page 613 of 720 when software standby mode is cleared by the falling edge or both edges of the irq pin, the irq pin should be high when the cpu enters software standby mode (when the clock pulse stops) and should be low when the cpu returns from software standby mode (when the clock is initiated after the oscillation stabilization). when software standby mode is cleared by the rising edge of the irq pin, the irq pin should be low when the cpu enters software standby mode (when the clock pulse stops) and should be high when the cpu returns from software standby mode (when the clock is initiated after the oscillation stabilization). note: * when the irq pin is set to falling-edge detection or both-edge detection, clock oscillation starts at falling-edge detection. when the irq pin is set to rising-edge detection, clock oscillation starts at rising-edg e detection. do not set the irq pin to low-level detection. ? clearing by the hstby pin when the hstby pin is driven low, the cpu shifts to hardware standby mode. software standby mode application example: figure 24.2 shows an example in which a transition is made to software standby mode at the falling edge of the nmi pin, and software standby mode is cleared at a rising edge of the nmi pin. in this example, when the nmi pin is driven low while the nmi edge select bit (nmie) in icr1 is 0 (falling edge detection), an nmi interrupt is accepte d. then, the nmie bit is set to 1 (rising edge detection) in the nmi exception service routine, the ssby bit in sbycr is set to 1, and a sleep instruction is executed to transf er to software standby mode. software standby mode is cleared by driving the nmi pin from low to high.
rev. 2.00, 09/04, page 614 of 720 oscillator ck nmi input nmie bit ssby bit lsi state oscillation start time program execution state exception service routine software standby mode wdt setting time nmi exception handling nmi exception handling oscillation stabilization time figure 24.2 nmi timing in software standby mode 24.3.3 hardware standby mode transition to hardware standby mode: when the hstby pin is driven low, a transition is made to hardware standby mode from any mode. in hardware standby mode, all functions enter the reset state and stop operation, resulting in a significant reduction in power consumption. as long as the specified voltage is supplied, on-chip ram data is retained. in order to retain on-chip ram data, the rame bit in syscr should be cleared to 0 before driving the hstby pin low. do not change the state of the mode pins (md3 to md0) while the cpu is in hardware standby mode. clearing hardwa re standby mode: hardware standby mode is cleared by means of the hstby pin and the res pin. when the hstby pin is driven high while the res pin is low, the reset state is set and clock oscillation is started. ensure that the res pin is held low until the clock oscillation stabilizes. when the res pin is then driven high, a transition is made to the program execution state via the power-on re set exception handling state. hardware standby mode timing: figure 24.3 shows a transition -timing example to hardware standby mode.
rev. 2.00, 09/04, page 615 of 720 in this example, the hstby pin is driven low, then the transition to hardware standby mode is made. hardware standby mode is cleared when the hstby pin is driven high and then the res pin is driven high after the elapse of the oscillation stabilization time of the clock pulse. oscillation stabilization time reset exception handling oscillator res hstby figure 24.3 transition timi ng to hardware standby mode 24.3.4 module standby mode module standby mode can be set for individual on-chip peripheral functions. when the corresponding mstp bit in mstcr is set to 1, module operation st ops at the end of the bus cycle and a transition is made to module standby mode. the cpu continues operating independently. when the corresponding mstp bit is cleared to 0, module standby mode is cleared and the module starts operating at the end of the bus cycle. in module standby mode, the internal states of modules are initialized. after reset clearing, the sci, mtu, mmt, cmt, and a/d converter are in module standby mode. when an on-chip supporting module is in module standby mode, re ad/write access to its registers is disabled. 24.4 usage notes 24.4.1 i/o port status when a transition is mode to software standby mode while the port high-impedance bit (hiz) in sbycr is 0, i/o port states are retained. therefore, there is no reduction in current consumption for the output current when a high-level signal is output.
rev. 2.00, 09/04, page 616 of 720 24.4.2 current consumptio n during oscillation stabilization wait period current consumption increases during the oscillation stabilization wait period. 24.4.3 on-chip peripheral module interrupt relevant interrupt operations cannot be performed in module standby mode. consequently, if the cpu enters module standby mode while an interrupt has been requested, it will not be possible to clear the cpu interrupt source or the dtc activation source. interrupts should therefore be disabled before entering module standby mode. 24.4.4 writing to mstcr1 and mstcr2 mstcr1 and mstcr2 should only be written to by the cpu. 24.4.5 handling of hstby pin power should not be supplied while the hstby pin is at the low level. to enter hardware standby mode, the hstby pin can be set to the low level when the oscillation stabilization time has elapsed after power supply. 24.4.6 electromagnetic interference on hstby pin the hstby signal controls start and stop for all functions of this lsi, including the clock pulse generator. therefore, please keep in mind that electromagnetic interference on the hstby pin causes malfunction of this lsi. if using the hardware standby function of this lsi which is exposed to the environment in which lots of electromagnetic interferen ce sources exist, connecting a noise filter such as an r-c circuit shown in figure 24.4 to the hstby pin is recommended. hstby r c c: 0.1 f r: 10k to 100k ? (recommendation) hstby control curcuit this lsi figure 24.4 example of external circuit connected to hstby pin
rev. 2.00, 09/04, page 617 of 720 24.4.7 dtc or aud operation in sleep mode in sleep mode, data should not be accessed by the dtc or aud.
rev. 2.00, 09/04, page 618 of 720
rev. 2.00, 09/04, page 619 of 720 section 25 electrical characteristics 25.1 absolute maximum ratings table 25.1 shows the absolute maximum ratings. table 25.1 absolute maximum ratings item symbol rating unit power supply voltage v cc ?0.3 to +7.0 v extal and h-udi pins vin ?0.3 to v cc +0.3 v input voltage all pins other than analog input, extal, and h-udi pins vin ?0.3 to v cc +0.3 v analog supply voltage av cc ?0.3 to +7.0 v analog input voltage v an ?0.3 to av cc +0.3 v standard product * ?20 to +75 operating temperature (except writing or erasing flash memory) wide temperature-range product * t opr ?40 to +85 c operating temperature (writing or erasing flash memory) t weopr ?20 to +75 c storage temperature t stg ?55 to +125 c [operating precautions] operating the lsi in excess of the absolut e maximum ratings may result in permanent damage. note: * see page 2 for correspondence of the standard product, wide temperature-range product, and product model name.
rev. 2.00, 09/04, page 620 of 720 25.2 dc characteristics table 25.2 dc characteristics conditions: v cc = 4.5 to 5.5 v, av cc = 4.5 to 5.5 v, v ss = pllv ss = av ss = 0 v, t a = ?20 c to +75 c (standard product)* 1 , t a = ?40 c to +85 c (wide temperature-range product)* 1 . item symbol min typ max unit measurement conditions res , mres , hstby , nmi, fwp, md3 to md0 v cc ? 0.7 ? v cc + 0.3 v extal v cc ? 0.7 ? v cc + 0.3 v dbgmd v cc ? 0.5 ? v cc + 0.3 v a/d port 2.2 ? av cc + 0.3 v input high-level voltage (except schmitt trigger input voltage) other input pins v ih 2.2 ? v cc + 0.3 v res , mres , hstby , nmi, fwp, md3 to md0, extal, dbgmd ?0.3 ? 0.5 v input low-level voltage (except schmitt trigger input voltage) other input pins v il ?0.3 ? 0.8 v v t+ (v ih ) 4.0 ? v cc + 0.3 v v t? (v il ) ?0.3 ? 1.0 v schmitt trigger input voltage irq3 to irq0 , poe6 to poe0 , tclka to tclkd, tioc0a to tioc0d, tioc1a, tioc1b, tioc2a, tioc2b, tioc3a to tioc3d, tioc4a to tioc4d v t+ ?v t? 0.4 ? ? v res , mres , nmi, hstby , fwp, md3 to md0, dbgmd ? ? 1.0 a vin = 0.5 to v cc ?0.5 v ports f ? ? 1.0 a vin = 0.5 to av cc ?0.5 v input leak current other input pins | i in | ? ? 1.0 a vin = 0.5 to v cc ?0.5 v
rev. 2.00, 09/04, page 621 of 720 item symbol min typ max unit measurement conditions three-state leak current (while off) port a, b, d, e | i tsi | ? ? 1.0 a vin = 0.5 to v cc ?0.5 v v cc ? 0.5 ? ? v i oh = ?200 a output high- level voltage all output pins v oh 3.5 ? ? v i oh = ?1 ma all output pins ? ? 0.4 v i ol = 1.6 ma output low- level voltage pe9, pe11 to pe21 v ol ? ? 1.5 v i ol = 15 ma res ? ? 80 pf nmi ? ? 50 pf input capacitance all other input pins c in ? ? 20 pf vin = 0 v = 1 mhz ta = 25 c ? 180 200 ma = 40 mhz clock 1:1 ? 120 140 ma = 25 mhz ? 220 235 ma = 50 mhz normal operation clock 1:1/2 ? 160 180 ma = 40 mhz clock 1:1 ? 140 190 ma = 40 mhz sleep clock 1:1/2 ? 150 200 ma = 50 mhz ? 3 100 a t a 50 c standby ? ? 500 a 50 c < t a clock 1:1 ? 180 200 ma v cc = 5.0 v, = 40 mhz current consumption * 2 write operation clock 1:1/2 i cc ? 220 235 ma v cc = 5.0 v, = 50 mhz during a/d conversion, a/d converter idle state ? 2 5 ma analog supply current during standby ai cc ? ? 5 a ram standby voltage v ram 2.0 ? ? v v cc [operating precautions] 1. when the a/d converter is not used, do not leave the av cc , and av ss pins open. notes: 1. see page 2 for correspondence of the standard product, wide temperature-range product, and product model name. 2. the current consum ption is measured when v ih min = v cc ? 0.5 v, v il = 0.5 v, with all output pins unloaded.
rev. 2.00, 09/04, page 622 of 720 table 25.3 permitted output current values conditions: v cc = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, v ss = pllv ss = av ss = 0 v, t a = ?20 c to +75 c (standard product)* 1 , t a = ?40 c to +85 c (wide temperature-range product)* 1 . item symbol min typ max unit output low-level permissible current (per pin) i ol ? ? 2.0 * 2 ma output low-level permissible current (total) i ol ? ? 110 ma output high-level permissible current (per pin) ?i oh ? ? 2.0 ma output high-level permissible current (total) ?i oh ? ? 25 ma [operating precautions] to assure lsi reliability, do not exceed the output values listed in this table. notes: 1. see page 2 for correspondence of the standard product, wide temperature-range product, and product model name. 2. i ol = 15 ma (max) about the pins pe9, pe11 to pe 21. however, three pins at most are permitted to have simultaneously i ol > 2.0 ma among these pins.
rev. 2.00, 09/04, page 623 of 720 25.3 ac characteristics 25.3.1 test conditions fo r the ac characteristics input reference levels high level: v ih minimum value, low level: v il maximum value output reference levels high level: 2.0 v, low level: 0.8 v i ol i oh c l v ref v dut output lsi output pin cl is a total value that includes the capacitance of measurement equipment, and is set as follows: 30 pf: ck, cs0 , back , irqout , audck 50 pf: a17 to a0, d7 to d0, rd , wrl , tdo 100 pf: audata3 to audata0, audsync 30 pf: port output pins and peripheral module output pins other than the above it is assumed that i ol = 1.6 ma, i oh = 200 a in the test conditions. figure 25.1 output load circuit
rev. 2.00, 09/04, page 624 of 720 25.3.2 clock timing table 25.4 shows the clock timing. table 25.4 clock timing conditions: v cc = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, v ss = pllv ss = av ss = 0 v, t a = ?20 c to +75 c (standard product)*, t a = ?40 c to +85 c (wide temperature-range product)*. item symbol min max unit figures 50mhz operation * 4 50 operating frequency 40mhz operation * f op 4 40 mhz 50mhz operation * 20 250 clock cycle time 40mhz operation * t cyc 25 250 ns clock low-level pulse width t cl 4 ? ns clock high-level pulse width t ch 4 ? ns clock rise time t cr ? 5 ns clock fall time t cf ? 5 ns figure 25.2 50mhz operation * 4 12.5 extal clock input frequency 40mhz operation * f ex 4 10.0 mhz 50mhz operation * 80 250 extal clock input cycle time 40mhz operation * t excyc 100 250 ns 50mhz operation * 35 ? extal clock input low-level pulse width 40mhz operation * t exl 45 ? ns 50mhz operation * 35 ? extal clock input high-level pulse width 40mhz operation * t exh 45 ? ns extal clock input rise time t exr ? 5 ns extal clock input fall time t exf ? 5 ns figure 25.3 reset oscillation settling time t osc1 10 ? ms standby return oscillation settling time t osc2 10 ? ms figure 25.4 clock cycle time for peripheral modules t pcyc 25 500 ns note: * see page 2 for correspondence of the standard product, wide temperature-range product, and product model name.
rev. 2.00, 09/04, page 625 of 720 t cyc t ch t cf t cr v oh ck v oh 1/2v cc 1/2v cc v oh v ol v ol t cl figure 25.2 system clock timing t excyc t exh t exf t exr v ih extal v ih 1/2v cc 1/2v cc v ih v il v il t exl figure 25.3 extal clock input timing ck v cc v cc min t osc1 t osc1 t osc2 hstby res figure 25.4 oscillation settling time
rev. 2.00, 09/04, page 626 of 720 25.3.3 control signal timing table 25.5 shows control signal timing. table 25.5 control signal timing conditions: v cc = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, v ss = pllv ss = av ss = 0 v, t a = ?20 c to +75 c (standard product)* 1 , t a = ?40 c to +85 c (wide temperature-range product)* 1 . item symbol min max unit figures res rise time, fall time t resr , t resf ? 200 ns res pulse width t resw 25 ? t cyc res setup time t ress 25 ? ns mres pulse width t mresw 20 ? t cyc mres setup time t mress 19 ? ns md3 to md0 setup time t mds 20 ? t cyc nmi rise time, fall time t nmir , t nmiif ? 200 ns figure 25.5 figure 25.6 nmi setup time t nmis 19 ? ns irq3 to irq0 setup time * 2 (edge detection) t irqes 19 ? ns irq3 to irq0 setup time * 2 (level detection) t irqls 19 ? ns nmi hold time t nmih 19 ? ns irq3 to irq0 hold time t irqeh 19 ? ns figure 25.7 irqout output delay time t irqod ? 100 ns figure 25.8 bus request setup time t brqs 19 ? ns bus acknowledge delay time 1 t backd1 ? 30 ns bus acknowledge delay time 2 t backd2 ? 30 ns bus three-state delay time t bzd ? 30 ns figure 25.9 notes: 1. see page 2 for correspondence of the standard product, wide temperature-range product, and product model name. 2. the res , mres , nmi and irq3 to irq0 signals are asynchronous inputs, but when the setup times shown here are observed, the signals are considered to have been changed at clock rise ( res , mres ) or fall (nmi and irq3 to irq0 ). if the setup times are not observed, the recognition of thes e signals may be delayed until the next clock rise or fall.
rev. 2.00, 09/04, page 627 of 720 t ress t mds v oh v ih v ih v ih v il v il v il t ress t resw ck md3 to md0 res figure 25.5 reset input timing ck mres t mresw t mress t mress v ih v il v il figure 25.6 reset input timing
rev. 2.00, 09/04, page 628 of 720 v ih v ih v il v il t nmis t nmih v ih v ol v ol v il v il t irqes t irqeh t irqls ck nmi irq edge irq level figure 25.7 interrupt signal input timing t irqod v oh v ol t irqod ck irqout v oh figure 25.8 interrupt signal outp ut timing t brqs t backd1 t brqs t bzd t bzd hi-z hi-z v ol v ol v ol v oh v oh v oh v oh v ih t backd2 ck breq (input) back (output) rd , csn , wrxx a17 to a0, d7 to d0 figure 25.9 bus release timing
rev. 2.00, 09/04, page 629 of 720 25.3.4 bus timing table 25.6 shows bus timing. table 25.6 bus timing conditions: v cc = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, v ss = pllv ss = av ss = 0 v, t a = ?20 c to +75 c (standard product)* 1 , t a = ?40 c to +85 c (wide temperature-range product)* 1 . item symbol min typ max unit figures address delay time t ad ? 22 30 ns cs delay time 1 t csd1 ? 22 35 ns cs delay time 2 t csd2 ? 15 35 ns read strobe delay time 1 t rsd1 ? 20 35 ns read strobe delay time 2 t rsd2 ? 15 35 ns read data setup time t rds 15 ? ? ns read data hold time t rdh 0 ? ? ns write strobe delay time 1 t wsd1 ? 20 30 ns write strobe delay time 2 t wsd2 ? 15 30 ns write data delay time t wdd ? ? 30 ns write data hold time t wdh 0 ? ? ns figures 25.10, 25.11 wait setup time t wts 15 ? ? ns wait hold time t wth 0 ? ? ns figure 25.12 read data access time t acc t cyc (2+n)- 35 * 2 * 3 ? ? ns access time from read strobe t oe t cyc (1.5+n)- 33 * 2 ? ? ns write address setup time t as 0 * 4 ? ? ns write address hold time t wr 5 * 5 ? ? ns write data hold time t wrh 0 * 4 ? ? ns figures 25.10, 25.11 notes: 1. see page 2 for correspondence of the standard product, wide temperature-range product, and product model name. 2. n is the number of wait cycles. 3. at the cs assert period extension, t cyc (3 + n) - 35. 4. at the cs assert period extension, t cyc . 5. at the cs assert period extension, 5 + t cyc .
rev. 2.00, 09/04, page 630 of 720 note: t rdh : specified from the negate timing of a17 to a0, csn , or rd , whichever is first. ck a17 to a0 csn rd (read) wrx (write) d7 to d0 (read) d7 to d0 (write) t 1 t ad v oh v ol t 2 t csd1 t rsd1 t oe t rsd2 t rds t acc t as t rdh t wsd2 t wr t wsd1 t wrh t csd2 t wdh t wdd figure 25.10 basi c cycle (no waits)
rev. 2.00, 09/04, page 631 of 720 note: t rdh : specified from the negate timing of a17 to a0, csn , or rd , whichever is first. ck a17 to a0 csn rd (read) wrx (write) d7 to d0 (read) d7 to d0 (write) t 1 t ad t w t 2 t csd1 v ol v oh t rsd1 t oe t rsd2 t rds t acc t as t rdh t wsd2 t wr t wsd1 t csd2 t wdh t wrh t wdd figure 25.11 basic cycl e (one software wait)
rev. 2.00, 09/04, page 632 of 720 t wth t wth t wts t wts ck a17 to a0 csn rd (read) d7 to d0 (read) d7 to d0 (write) wrx (write) wait t 1 t w t w t wo t 2 note: t rdh : specified from the negate timing of a17 to a0, csn , or rd , whichever is first. figure 25.12 basic cycle (two software waits + waits by wait signal)
rev. 2.00, 09/04, page 633 of 720 25.3.5 multi-function timer pulse unit (mtu)timing table 25.7 shows multi-function timer pulse unit timing. table 25.7 multi-function timer pulse unit timing conditions: v cc = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, v ss = pllv ss = av ss = 0 v, t a = ?20 c to +75 c (standard product)*, t a = ?40 c to +85 c (wide temperature-range product)*. item symbol min max unit figures output compare output delay time t tocd ? 100 ns input capture input setup time t tics 19 ? ns figure 25.13 timer input setup time t tcks 35 ? ns timer clock pulse width (single edge specified) t tckwh/l 1.5 ? t pcyc timer clock pulse width (both edges specified) t tckwh/l 2.5 ? t pcyc timer clock pulse width (phase count mode) t tckwh/l 2.5 ? t pcyc figure 25.14 note: * see page 2 for correspondence of the standard product, wide temperature-range product, and product model name. ck output compare output input capture input t tocd t tics figure 25.13 mtu input/output timing ck tclka to tclkd t tcks t tcks t tckwh t tckwl figure 25.14 mtu clock input timing
rev. 2.00, 09/04, page 634 of 720 25.3.6 i/o port timing table 25.8 shows i/o port timing. table 25.8 i/o port timing conditions: v cc = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, v ss = pllv ss = av ss = 0 v, t a = ?20 c to +75 c (standard product)*, t a = ?40 c to +85 c (wide temperature-range product)*. item symbol min max unit figures port output data delay time t pwd ? 100 ns port input hold time t prh 19 ? ns port input setup time t prs 19 ? ns figure 25.15 [operating precautions] the port input signals are asynchronous. they are, however, considered to have been changed at ck clock falling edge with two-state intervals shown in figure 25.15. if the setup times shown here are not observed, recognition may be delayed until the clock falling two states after that timing. note: * see page 2 for correspondence of the standard product, wide temperature-range product, and product model name. t prs t prh t pwd ck port (read) port (write) figure 25.15 i/o port input/output timing
rev. 2.00, 09/04, page 635 of 720 25.3.7 watchdog timer (wdt)timing table 25.9 shows watchdog timer timing. table 25.9 watchdog timer timing conditions: v cc = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, v ss = pllv ss = av ss = 0 v, t a = ?20 c to +75 c (standard product)*, t a = ?40 c to +85 c (wide temperature-range product)*. item symbol min max unit figures wdtovf delay time t wovd ? 100 ns figure 25.16 note: * see page 2 for correspondence of the standard product, wide temperature-range product, and product model name. t wovd t wovd v oh v oh ck wdtovf figure 25.16 wdt timing
rev. 2.00, 09/04, page 636 of 720 25.3.8 serial communication interface (sci)timing table 25.10 shows serial co mmunication interface timing. table 25.10 serial communi cation interface timing conditions: v cc = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, v ss = pllv ss = av ss = 0 v, t a = ?20 c to +75 c (standard product)*, t a = ?40 c to +85 c (wide temperature-range product)*. item symbol min max unit figures input clock cycle t scyc 4 ? t pcyc input clock cycle (clock sync) t scyc 6 ? t pcyc input clock pulse width t sckw 0.4 0.6 t scyc input clock rise time t sckr ? 1.5 t pcyc input clock fall time t sckf ? 1.5 t pcyc figure 25.17 transmit data delay time t txd ? 100 ns received data setup time t rxs 100 ? ns received data hold time t rxh 100 ? ns figure 25.18 note: * see page 2 for correspondence of the standard product, wide temperature-range product, and product model name. [operating precautions] the inputs and outputs are asynchronous in asynchronous mode, but as shown in figure 25.17, the received data is considered to have been change d at ck clock rise (two -clock intervals). the transmit signals change with a reference of ck clock rise (two-clock intervals). t sckw v ih v ih v ih v ih v il v il v il sck2 to sck4 t sckr t sckf t scyc figure 25.17 sci input timing
rev. 2.00, 09/04, page 637 of 720 t scyc sck2 to sck4 (input/output) txd2 to txd4 (transmit data) rxd2 to rxd4 (received data) sci input/output timing (clock synchronous mode) t txd t rxs t rxh v oh v oh t 1 ck txd2 to txd4 (transmit data) rxd2 to rxd4 (received data) sci input/output timing (asynchronous mode) t n t txd t rxs t rxh figure 25.18 sci input/output timing
rev. 2.00, 09/04, page 638 of 720 25.3.9 motor management timer (mmt) timing table 25.11 motor management timer timing conditions: v cc = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, v ss = pllv ss = av ss = 0 v, t a = ?20 c to +75 c (standard product)*, t a = ?40 c to +85 c (wide temperature-range product)*. item symbol min max unit figures mmt output delay time t mtod ? 100 ns pcio input (when input is set) setup time t pcis 35 ? ns pcio input (when input is set) pulse width t pciw 1.5 ? tpcyc figure 25.19 note: * see page 2 for correspondence of the standard product, wide temperature-range product, and product model name. ck mmt output pcio input t mtod t pcis t pciw figure 25.19 mmt input/output timing
rev. 2.00, 09/04, page 639 of 720 25.3.10 port output enable (poe) timing table 25.12 port output enable timing conditions: v cc = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, v ss = pllv ss = av ss = 0 v, t a = ?20 c to +75 c (standard product)*, t a = ?40 c to +85 c (wide temperature-range product)*. item symbol min max unit figures poe input setup time t poes 100 ? ns poe input pulse width t poew 1.5 ? tpcyc figure 25.20 note: * see page 2 for correspondence of the standard product, wide temperature-range product, and product model name. ck poe input t poes t poew figure 25.20 poe input/output timing
rev. 2.00, 09/04, page 640 of 720 25.3.11 hcan2 timing table 25.13 shows hcan2 timing. table 25.13 hcan2 timing conditions: v cc = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, v ss = pllv ss = av ss = 0 v, t a = ?20 c to +75 c (standard product)*, t a = ?40 c to +85 c (wide temperature-range product)* item symbol min max unit figures transmit data delay time t htxd ? 100 ns received data setup time t hrxs 100 ? ns received data hold time t hrxh 100 ? ns figure 25.21 [operating precautions] the hcan2 input signals are asynchronous , but considered to have been changed at ck clock rise (two-clock intervals) shown in figure 25.21. the hcan2 output signals are asynchronous, but they change with a referenc e of ck clock rise (two-clock intervals) shown in figure 25.21. note: * see page 2 for correspondence of the standard product, wide temperature-range product, and product model name. v oh v oh ck htxd1 (transmit data) hrxd1 (received data) t htxd t hrxs t hrxh figure 25.21 hcan2 input/output timing
rev. 2.00, 09/04, page 641 of 720 25.3.12 a/d converter timing table 25.14 shows a/d converter timing. table 25.14 a/d converter timing conditions: v cc = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, v ss = pllv ss = av ss = 0 v, t a = ?20 c to +75 c (standard product)*, t a = ?40 c to +85 c (wide temperature-range product)* item symbol min typ max unit figure external trigger input start delay time t trgs 50 ? ? ns figure 25.22 note: * see page 2 for correspondence of the standard product, wide temperature-range product, and product model name. ck adtrg input adcr (adst = 1 set) 3 to 5 states t trgs v ol figure 25.22 external trigger input timing
rev. 2.00, 09/04, page 642 of 720 25.3.13 h-udi timing table 25.15 shows h-udi timing. table 25.15 h-udi timing conditions: v cc = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, v ss = pllv ss = av ss = 0 v, t a = ?20 c to +75 c (standard product)* 1 , t a = ?40 c to +85 c (wide temperature-range product)* 1 item symbol min max unit figures tck clock cycle t tcyc 60 * 2 ? ns tck clock high-level width t tckh 0.4 0.6 t tcyc tck clock low-level width t tckl 0.4 0.6 t tcyc figure 25.23 trst pulse width t trsw 20 ? t tcyc trst setup time t trss 30 ? ns figure 25.24 tms setup time t tmss 15 ? ns tms hold time t tmsh 10 ? ns tdi setup time t tdis 15 ? ns tdi hold time t tdih 10 ? ns tdo delay time t tdod ? 30 ns figure 25.25 notes: 1. see page 2 for correspondence of the standard product, wide temperature-range product, and product model name. 2. must not be lower than 2 t cyc . t tckh t tcyc v ih tck v ih v il v il v ih t tckl figure 25.23 h-udi clock timing
rev. 2.00, 09/04, page 643 of 720 t trss t trss v il v il v ih v il tck trst t trsw figure 25.24 h-udi trst timing tck tms tdi tdo t tmss t tmsh v il v ih v ih t tdis t tdih t tdod t tdod figure 25.25 h-udi input/output timing
rev. 2.00, 09/04, page 644 of 720 25.3.14 aud timing table 25.16 shows aud timing. table 25.16 aud timing conditions: v cc = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, v ss = pllv ss = av ss = 0 v, t a = ?20 c to +75 c (standard product)*, t a = ?40 c to +85 c (wide temperature-range product)* item symbol min max unit figures audrst pulse width (branch trace) t audrstw 20 ? t cyc audrst pulse width (ram monitor) t audrstw 5 ? t rmcyc audmd setup time (branch trace) t audmds 20 ? t cyc audmd setup time (ram monitor) t audmds 5 ? t rmcyc figure 25.26 branch trace clock cycle t btcyc 2 2 t cyc branch trace clock duty t btckw 40 60 % branch trace data delay time t btdd ? 30 ns branch trace data hold time t btdh 0 ? ns branch trace sync delay time t btsd ? 30 ns branch trace sync hold time t btsh 0 ? ns figure 25.27 ram monitor clock cycle t rmcyc 80 ? ns ram monitor clock low pulse width t rmckw 35 ? ns ram monitor output data delay time t rmdd 7 t rmcyc -20 ns ram monitor output data hold time t rmdhd 5 ? ns ram monitor input data setup time t rmds 30 ? ns ram monitor input data hold time t rmdh 5 ? ns ram monitor sync setup time t rmss 20 ? ns ram monitor sync hold time t rmsh 5 ? ns figure 25.28 load conditions: audck (output): cl = 30 pf audsync : cl = 100 pf audata3 to audata0: cl = 100 pf note: * see page 2 for correspondence of the standard product, wide temperature-range product, and product model name.
rev. 2.00, 09/04, page 645 of 720 t rmcyc t audrstw t audmds t cyc ck (branch trace) audck (input) (ram monitor) audrst audmd figure 25.26 aud reset timing audck (output) audata3 to audata0 (output) audsync (output) t btdd t btsd t btckw t btcyc t btdh t btsh figure 25.27 branch trace timing audck (input) audata3 to audata0 (output) audata3 to audata0 (input) audsync (input) t rmdd t rmds t rmss t rmdh t rmcyc t rmckw t rmdhd t rmsh figure 25.28 ram monitor timing
rev. 2.00, 09/04, page 646 of 720 25.3.15 ubc trigger timing table 25.17 shows ubc trigger timing. table 25.17 ubc trigger timing conditions: v cc = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, v ss = pllv ss = av ss = 0 v, t a = ?20 c to +75 c (standard product)*, t a = ?40 c to +85 c (wide temperature-range product)* item symbol min max unit figures ubctrg delay time t ubctgd ? 35 ns figure 25.29 note: * see page 2 for correspondence of the standard product, wide temperature-range product, and product model name. v oh ck ubctrg t ubctgd figure 25.29 ubc trigger timing
rev. 2.00, 09/04, page 647 of 720 25.4 a/d converter characteristics table 25.18 shows a/d co nverter characteristics. table 25.18 a/d converter characteristics conditions: v cc = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, v ss = pllv ss = av ss = 0 v, t a = ?20 c to +75 c (standard product)* 3 , t a = ?40 c to +85 c (wide temperature-range product)* 3 item min typ max unit resolution 10 10 10 bit a/d conversion time ? ? 6.7 * 1 /5.4 * 2 s analog input capacitance ? ? 20 pf permitted analog signal source impedance ? ? 3 * 1 /1 * 2 k ? non-linear error (reference value) ? ? 3.0 * 1 / 5.0 * 2 lsb offset error (reference value) ? ? 3.0 * 1 / 5.0 * 2 lsb full-scale error (reference value) ? ? 3.0 * 1 / 5.0 * 2 lsb quantization error ? ? 0.5 lsb absolute error ? ? 4.0 * 1 / 6.0 * 2 lsb notes: 1. value when (cks1, 0) = (11) and t pcyc = 50 ns 2. value when (cks1, 0) = (11) and t pcyc = 40 ns 3. see page 2 for correspondence of t he standard product, wide temperature-range product, and product model name.
rev. 2.00, 09/04, page 648 of 720 25.5 flash memory characteristics table 25.19 shows flash memory characteristics. table 25.19 flash memory characteristics conditions: v cc = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, v ss = pllv ss = av ss = 0 v, t a = ?20 c to +75 c (standard product)* 6 , t a = ?40 c to +85 c (wide temperature-range product)* 6 . item symbol min typ max unit remarks programming time * 1, * 2, * 4 t p ? 10 200 ms/ 128 bytes erase time * 1, * 3, * 5 t e ? 100 1200 ms/block reprogramming count n wec 100 * 7 10000 * 8 ? times standard product n wec ? ? 100 times wide temperature- range product data retained time t drp 10 * 9 ? ? years wait time after swe bit setting * 1 t sswe 1 1 ? s wait time after psu bit setting * 1 t spsu 50 50 ? s t sp30 28 30 32 s programmin g time wait t sp200 198 200 202 s programmin g time wait wait time after p bit setting * 1, * 4 t sp10 8 10 12 s additional- programming time wait wait time after p bit clear * 1 t cp 5 5 ? s wait time after psu bit clear * 1 t cpsu 5 5 ? s wait time after pv bit setting * 1 t spv 4 4 ? s wait time after h'ff dummy write * 1 t spvr 2 2 ? s wait time after pv bit clear * 1 t cpv 2 2 ? s wait time after swe bit clear * 1 t cswe 100 100 ? s programming maximum programming count * 1, * 4 n ? ? 1000 times wait time after swe bit setting * 1 t sswe 1 1 s wait time after esu bit setting * 1 t sesu 100 100 ? s wait time after e bit setting * 1, * 5 t se 10 10 100 ms erase time wait erase wait time after e bit clear * 1 t ce 10 10 ? s
rev. 2.00, 09/04, page 649 of 720 item symbol min typ max unit remarks item wait time after esu bit clear * 1 t cesu 10 10 ? s wait time after ev bit setting * 1 t sev 20 20 ? s wait time after h'ff dummy write * 1 t sevr 2 2 ? s wait time after ev bit clear * 1 t cev 4 4 ? s wait time after swe bit clear * 1 t cswe 100 100 ? s erase maximum erase count * 1, * 5 n 12 ? 120 times notes: 1. make each time setting in accordance with the program/program-verify algorithm or erase/erase-verify algorithm. 2. programming time per 128 bytes (shows the total period for which the p-bit in the flash memory control register (flmcr1) is set. it does not include the programming verification time.) 3. 1-block erase time (shows the total period for which the e-bit in flmcr1 is set. it does not include the erase verification time.) 4. to specify the maximum programming time value (t p (max)) in the 128-bytes programming algorithm, set the max. value (1000) for the maximum programming count (n). the wait time after p bit setting should be changed as follows according to the value of the programming counter (n). programming counter (n) = 1 to 6: t sp30 = 30 s programming counter (n) = 7 to 1000: t sp200 = 200 s [in additional programming] programming counter (n) = 1 to 6: t sp10 = 10 s 5. for the maximum erase time (t e (max)), the following relationship applies between the wait time after e bit setting (t se ) and the maximum erase count (n): t e (max) = wait time after e bit setting (t se ) x maximum erase count (n) to set the maximum erase time, the values of (t se ) and (n) should be set so as to satisfy the above formula. examples: when t se = 100 ms, n = 12 times when t se = 10 ms, n = 120 times 6. see page 2 for correspondence of t he standard product, wide temperature-range product, and product model name. 7. all characteristics after rewriting are gu aranteed up to this minimum rewriting times (therefore 1 to min. times). 8. reference value at 25 c (a rough rewriting target number to which a rewriting usually functions) 9. data retention characteristics when rewritin g is executed within the specification values including minimum values.
rev. 2.00, 09/04, page 650 of 720
rev. 2.00, 09/04, page 651 of 720 appendix a internal i/o register the column ?access size? show s the number of bits. the column ?access states? shows the number of access states, in units of cycles, of the specified reference clock. b, w, and l in the column repres ent 8-bit, 16-bit, and 32 -bit access, respectively. a.1 register addresses (order of address) register name abbreviation bits address module access size access states ? ? ? h'ffff8000 to h'ffff81bf ? ? ? serial mode register_2 smr_2 8 h'ffff81c0 8, 16 bit rate register_2 brr_2 8 h'ffff81c1 sci (channel 2) 8 serial control register_2 scr_2 8 h'ffff81c2 8, 16 transmit data register_2 tdr_2 8 h'ffff81c3 8 serial status register_2 ssr_2 8 h'ffff81c4 8, 16 receive data register_2 rdr_2 8 h'ffff81c5 8 serial direction control regi ster_2 sdcr_2 8 h'ffff81c6 8 in p cycles b: 2 w: 4 ? ? ? h'ffff81c7 to h'ffff81cf ? serial mode register_3 smr_3 8 h'ffff81d0 8, 16 bit rate register_3 brr_3 8 h'ffff81d1 sci (channel 3) 8 serial control register_3 scr_3 8 h'ffff81d2 8, 16 transmit data register_3 tdr_3 8 h'ffff81d3 8 serial status register_3 ssr_3 8 h'ffff81d4 8, 16 receive data register_3 rdr_3 8 h'ffff81d5 8 serial direction control regi ster_3 sdcr_3 8 h'ffff81d6 8 ? ? ? h'ffff81d7 to h'ffff81df ? serial mode register_4 smr_4 8 h'ffff81e0 8, 16 bit rate register_4 brr_4 8 h'ffff81e1 sci (channel 4) 8 serial control register_4 scr_4 8 h'ffff81e2 8, 16 transmit data register_4 tdr_4 8 h'ffff81e3 8 serial status register_4 ssr_4 8 h'ffff81e4 8, 16 receive data register_4 rdr_4 8 h'ffff81e5 8 serial direction control regi ster_4 sdcr_4 8 h'ffff81e6 8 ? ? ? h'ffff81e7 to h'ffff81ef ?
rev. 2.00, 09/04, page 652 of 720 register name abbreviation bits address module access size access states ? ? ? h'ffff81f0 to h'ffff81ff ? ? ? timer control register_3 tcr_3 8 h'ffff8200 8, 16, 32 timer control register_4 tcr_4 8 h'ffff8201 8 timer mode register_3 tmdr_3 8 h'ffff8202 mtu (channels 3 and 4) 8, 16 timer mode register_4 tmdr_4 8 h'ffff8203 8 timer i/o control register h_3 tiorh_3 8 h'ffff8204 8, 16, 32 timer i/o control register l_3 tiorl_3 8 h'ffff8205 8 timer i/o control register h_4 tiorh_4 8 h'ffff8206 8, 16 timer i/o control register l_4 tiorl_4 8 h'ffff8207 8 timer interrupt enable register_3 tier_3 8 h'ffff8208 8, 16, 32 timer interrupt enable register_4 tier_4 8 h'ffff8209 8 timer output master enable register toer 8 h'ffff820a 8, 16 timer output control register tocr 8 h'ffff820b 8 ? ? ? h'ffff820c timer gate control register tgcr 8 h'ffff820d 8 ? ? ? h'ffff820e ? ? ? h'ffff820f timer counter_3 tcnt_3 16 h'ffff8210 16, 32 timer counter_4 tcnt_4 16 h'ffff8212 16 timer period data register tcdr 16 h'ffff8214 16, 32 timer dead time data register tddr 16 h'ffff8216 16 timer general register a_3 tgra_3 16 h'ffff8218 16, 32 timer general register b_3 tgrb_3 16 h'ffff821a 16 timer general register a_4 tgra_4 16 h'ffff821c 16, 32 timer general register b_4 tgrb_4 16 h'ffff821e 16 timer sub-counter tcnts 16 h'ffff8220 16, 32 timer period buffer register tcbr 16 h'ffff8222 16 timer general register c_3 tgrc_3 16 h'ffff8224 16, 32 timer general register d_3 tgrd_3 16 h'ffff8226 16 timer general register c_4 tgrc_4 16 h'ffff8228 16, 32 timer general register d_4 tgrd_4 16 h'ffff822a 16 timer status register_3 tsr_3 8 h'ffff822c 8, 16 timer status register_4 tsr_4 8 h'ffff822d 8 ? ? ? h'ffff822e to h'ffff823f in p cycles b: 2 w: 2 l: 4
rev. 2.00, 09/04, page 653 of 720 register name abbreviation bits address module access size access states timer start register tstr 8 h'ffff8240 8, 16 timer synchro register tsyr 8 h'ffff8241 mtu (common) 8 ? ? ? h'ffff8242 to h'ffff825f in p cycles b: 2 w: 2 timer control register_0 tcr_0 8 h'ffff8260 8, 16, 32 timer mode register_0 tmdr_0 8 h'ffff8261 mtu (channel 0) 8 timer i/o control register h_0 tiorh_0 8 h'ffff8262 8, 16 timer i/o control register l_0 tiorl_0 8 h'ffff8263 8 timer interrupt enable register_0 tier_0 8 h'ffff8264 8, 16, 32 timer status register_0 tsr_0 8 h'ffff8265 8 timer counter_0 tcnt_0 16 h'ffff8266 16 timer general register a_0 tgra_0 16 h'ffff8268 16, 32 timer general register b_0 tgrb_0 16 h'ffff826a 16 timer general register c_0 tgrc_0 16 h'ffff826c 16, 32 timer general register d_0 tgrd_0 16 h'ffff826e 16 ? ? ? h'ffff8270 to h'ffff827f ? timer control register_1 tcr_1 8 h'ffff8280 8, 16 timer mode register_1 tmdr_1 8 h'ffff8281 mtu (channel 1) 8 timer i/o control register_1 tior_1 8 h'ffff8282 8 ? ? ? h'ffff8283 ? timer interrupt enable register_1 tier_1 8 h'ffff8284 8, 16, 32 timer status register_1 tsr_1 8 h'ffff8285 8 timer counter_1 tcnt_1 16 h'ffff8286 16 timer general register a_1 tgra_1 16 h'ffff8288 16, 32 timer general register b_1 tgrb_1 16 h'ffff828a 16 ? ? ? h'ffff828c to h'ffff829f ? timer control register_2 tcr_2 8 h'ffff82a0 8, 16 timer mode register_2 tmdr_2 8 h'ffff82a1 mtu (channel 2) 8 timer i/o control register_2 tior_2 8 h'ffff82a2 8 ? ? ? h'ffff82a3 ? timer interrupt enable register_2 tier_2 8 h'ffff82a4 8, 16, 32 timer status register_2 tsr_2 8 h'ffff82a5 8 timer counter_2 tcnt_2 16 h'ffff82a6 16 timer general register a_2 tgra_2 16 h'ffff82a8 16, 32 in p cycles b: 2 w: 2 l: 4
rev. 2.00, 09/04, page 654 of 720 register name abbreviation bits address module access size access states timer general register b_2 tgrb_2 16 h'ffff82aa 16 in p cycles b: 2 w: 2 l: 4 ? ? ? h'ffff82ac to h'ffff833f ? ? ? ? h'ffff8340 to h'ffff8347 intc ? interrupt priority register a ipra 16 h'ffff8348 8, 16 ? ? ? h'ffff834a to h'ffff834d ? interrupt priority register d iprd 16 h'ffff834e 8, 16 interrupt priority register e ipre 16 h'ffff8350 8, 16, 32 interrupt priority register f iprf 16 h'ffff8352 8, 16 interrupt priority register g iprg 16 h'ffff8354 8, 16, 32 interrupt priority register h iprh 16 h'ffff8356 8, 16 interrupt control register 1 icr1 16 h'ffff8358 8, 16, 32 irq status register isr 16 h'ffff835a 8, 16 interrupt priority register i ipri 16 h'ffff835c 8, 16, 32 ? ? ? h'ffff835e ? interrupt priority register k iprk 16 h'ffff8360 8, 16, 32 ? ? ? h'ffff8362 to h'ffff8365 ? interrupt control register 2 icr2 8 h'ffff8366 8, 16 ? ? ? h'ffff8368 to h'ffff837f ? in cycles b: 2 w: 2 l: 4 ? ? ? h'ffff8380 to h'ffff8381 ? ? ? port a data register l padrl 16 h'ffff8382 i/o 8, 16 ? ? ? h'ffff8384 to h'ffff8385 ? ? port a i/o register l paiorl 16 h'ffff8386 pfc 8, 16 ? ? ? h'ffff8388 to h'ffff8389 ? ? port a control register l3 pacrl3 16 h'ffff838a pfc 8, 16 port a control register l1 pacrl1 16 h'ffff838c 8, 16, 32 port a control register l2 pacrl2 16 h'ffff838e 8, 16 port b data register pbdr 16 h'ffff8390 i/o 8, 16 in cycles b: 2 w: 2 l: 4
rev. 2.00, 09/04, page 655 of 720 register name abbreviation bits address module access size access states ? ? ? h'ffff8392 to h'ffff8393 ? ? port b i/o register pbior 16 h'ffff8394 pfc 8, 16, 32 ? ? ? h'ffff8396 to h'ffff8397 ? ? port b control register 1 pbcr1 16 h'ffff8398 pfc 8, 16, 32 port b control register 2 pbcr2 16 h'ffff839a 8, 16 ? ? ? h'ffff839c to h'ffff83a1 ? ? port d data register l pddrl 16 h'ffff83a2 i/o 8, 16 ? ? ? h'ffff83a4 to h'ffff83a5 ? ? port d i/o register l pdiorl 16 h'ffff83a6 pfc 8, 16 ? ? ? h'ffff83a8 to h'ffff83ab ? ? port d control register l1 pdcrl1 16 h'ffff83ac pfc 8, 16, 32 port d control register l2 pdcrl2 16 h'ffff83ae 8, 16 port e data register l pedrl 16 h'ffff83b0 i/o 8, 16, 32 port f data register pfdr 16 h'ffff83b2 8, 16 port e i/o register l peiorl 16 h'ffff83b4 pfc 8, 16, 32 port e i/o register h peiorh 16 h'ffff83b6 8, 16 port e control register l1 pecrl1 16 h'ffff83b8 8, 16, 32 port e control register l2 pecrl2 16 h'ffff83ba 8, 16 port e control register h pecrh 16 h'ffff83bc 8, 16, 32 port e data register h pedrh 16 h'ffff83be i/o 8, 16 in cycles b: 2 w: 2 l: 4 input control/status register 1 icsr1 16 h'ffff83c0 mtu 8, 16, 32 output control/status register ocsr 16 h'ffff83c2 8, 16 input control/status register 2 icsr2 16 h'ffff83c4 mmt 8, 16 in p cycles b: 2 w: 2 l: 4 ? ? ? h'ffff83c6 to h'ffff83cf ? ? compare match timer start register cmstr 16 h'ffff83d0 cmt 8, 16, 32 compare match timer control/status register_0 cmcsr_0 16 h'ffff83d2 8, 16 compare match timer counter_0 cmcnt_0 16 h'ffff83d4 8, 16, 32 compare match timer constant register_0 cmcor_0 16 h'ffff83d6 8, 16 in cycles b: 2 w: 2 l: 4
rev. 2.00, 09/04, page 656 of 720 register name abbreviation bits address module access size access states compare match timer control/status register_1 cmcsr_1 16 h'ffff83d8 8, 16, 32 compare match timer counter_1 cmcnt_1 16 h'ffff83da 8, 16 compare match timer constant register_1 cmcor_1 16 h'ffff83dc 8, 16 ? ? ? h'ffff83de in cycles b: 2 w: 2 l: 4 ? ? ? h'ffff83e0 to h'ffff841f ? ? ? a/d data register 0 addr0 16 h'ffff8420 8, 16 a/d data register 1 addr1 16 h'ffff8422 a/d (channel 0) 8, 16 a/d data register 2 addr2 16 h'ffff8424 8, 16 a/d data register 3 addr3 16 h'ffff8426 8, 16 a/d data register 4 addr4 16 h'ffff8428 8, 16 a/d data register 5 addr5 16 h'ffff842a a/d (channel 1) 8, 16 a/d data register 6 addr6 16 h'ffff842c 8, 16 a/d data register 7 addr7 16 h'ffff842e 8, 16 a/d data register 8 addr8 16 h'ffff8430 8, 16 a/d data register 9 addr9 16 h'ffff8432 a/d (channel 0) 8, 16 a/d data register 10 addr10 16 h'ffff8434 8, 16 a/d data register 11 addr11 16 h'ffff8436 8, 16 a/d data register 12 addr12 16 h'ffff8438 8, 16 a/d data register 13 addr13 16 h'ffff843a a/d (channel 1) 8, 16 a/d data register 14 addr14 16 h'ffff843c 8, 16 a/d data register 15 addr15 16 h'ffff843e 8, 16 ? ? ? h'ffff8440 to h'ffff847f ? ? a/d control/status register_0 adcsr_0 8 h'ffff8480 a/d 8, 16 a/d control/status register_1 adcsr_1 8 h'ffff8481 8 ? ? ? h'ffff8482 to h'ffff8487 ? a/d control register_0 adcr_0 8 h'ffff8488 8, 16 a/d control register_1 adcr_1 8 h'ffff8489 8 in p cycles b: 3 w: 6 ? ? ? h'ffff848a to h'ffff857f ? flash memory control register 1 flmcr1 8 h'ffff8580 8, 16 flash memory control register 2 flmcr2 8 h'ffff8581 8 erase block register 1 ebr1 8 h'ffff8582 flash (f-ztat only) 8, 16 erase block register 2 ebr2 8 h'ffff8583 8 in cycles b: 3 w: 6
rev. 2.00, 09/04, page 657 of 720 register name abbreviation bits address module access size access states ? ? ? h'ffff8584 to h'ffff85ff ? in cycles b: 3 w: 6 user break address register h ubarh 16 h'ffff8600 ubc 8, 16, 32 user break address register l ubarl 16 h'ffff8602 8, 16 user break address mask register h ubamrh 16 h'ffff8604 8, 16, 32 user break address mask register l ubamrl 16 h'ffff8606 8, 16 user break bus cycle register ubbr 16 h'ffff8608 8, 16, 32 user break control register ubcr 16 h'ffff860a 8, 16 ? ? ? h'ffff860c to h'ffff860f in cycles b: 3 w: 3 l: 6 timer control/status register tcsr 8 h'ffff8610 8 * 2 /16 * 1 timer counter tcnt * 1 8 h'ffff8610 16 timer counter tcnt * 2 8 h'ffff8611 8 in cycles b: 3 w: 3 reset control/status register rstcsr * 1 8 h'ffff8612 16 reset control/status register rstcsr * 2 8 h'ffff8613 wdt * 1: write cycle * 2: read cycle 8 standby control register sbycr 8 h'ffff8614 8 in cycles b: 3 ? ? ? h'ffff8615 to h'ffff8617 ? ? system control register syscr 8 h'ffff8618 power- down state 8 ? ? ? h'ffff8619 to h'ffff861b ? module standby control register 1 mstcr1 16 h'ffff861c 8, 16, 32 module standby control register 2 mstcr2 16 h'ffff861e 8, 16 in p cycles b: 3 w: 3 l: 6 bus control register 1 bcr1 16 h'ffff8620 bsc 8, 16, 32 bus control register 2 bcr2 16 h'ffff8622 8, 16 wait control register 1 wcr1 16 h'ffff8624 8, 16 ? ? ? h'ffff8626 ? in cycles b: 3 w: 3 l: 6 ram emulation register ramer 16 h'ffff8628 flash 8, 16 in cycles b: 3 w: 3 ? ? h'ffff862a to h'ffff864f ? ? ? ? ? h'ffff8650 to h'ffff86ff ? ? ?
rev. 2.00, 09/04, page 658 of 720 register name abbreviation bits address module access size access states dtc enable register a dtea 8 h'ffff8700 dtc 8, 16, 32 dtc enable register b dteb 8 h'ffff8701 8 dtc enable register c dtec 8 h'ffff8702 8, 16 dtc enable register d dted 8 h'ffff8703 8 in cycles b: 3 w: 3 l: 6 ? ? h'ffff8704 to h'ffff8705 ? dtc control/status register dtcsr 16 h'ffff8706 8, 16 dtc information base register dtbr 16 h'ffff8708 8, 16 ? ? h'ffff870a to h'ffff870f ? dtc enable register e dtee 8 h'ffff8710 8, 16 dtc enable register f dtef 8 h'ffff8711 8 ? ? h'ffff8712 to h'ffff87f3 ? ad trigger select register adtsr 8 h'ffff87f4 a/d 8 ? ? h'ffff87f5 to h'ffff89ff ? in p cycles b: 3 timer mode register mmt_tmdr 8 h'ffff8a00 mmt 8 ? ? h'ffff8a01 ? timer control register tcnr 8 h'ffff8a02 8 ? ? h'ffff8a03 ? timer status register mmt_tsr 8 h'ffff8a04 8 ? ? h'ffff8a05 ? timer counter mmt_tcnt 16 h'ffff8a06 16 timer period data register tpdr 16 h'ffff8a08 16, 32 timer period buffer register tpbr 16 h'ffff8a0a 16 timer dead time data register mmt_tddr 16 h'ffff8a0c 16 ? ? h'ffff8a0e to h'ffff8a0f ? timer buffer register u_b tbru_b 16 h'ffff8a10 16, 32 timer general register uu tgruu 16 h'ffff8a12 16 timer general register u tgru 16 h'ffff8a14 16, 32 timer general register ud tgrud 16 h'ffff8a16 16 timer dead time counter 0 tdcnt0 16 h'ffff8a18 16, 32 in p cycles b: 2 w: 2 l: 4
rev. 2.00, 09/04, page 659 of 720 register name abbreviation bits address module access size access states timer dead time counter 1 tdcnt1 16 h'ffff8a1a mmt 16 timer buffer register u_f tbru_f 16 h'ffff8a1c 16 ? ? h'ffff8a1e to h'ffff8a1f ? timer buffer register v_b tbrv_b 16 h'ffff8a20 16, 32 timer general register vu tgrvu 16 h'ffff8a22 16 timer general register v tgrv 16 h'ffff8a24 16, 32 in p cycles w: 2 l: 4 timer general register vd tgrvd 16 h'ffff8a26 16 timer dead time counter 2 tdcnt2 16 h'ffff8a28 16, 32 timer dead time counter 3 tdcnt3 16 h'ffff8a2a 16 timer buffer register v_f tbrv_f 16 h'ffff8a2c 16 ? ? h'ffff8a2e to h'ffff8a2f ? timer buffer register w_b tbrw_b 16 h'ffff8a30 16, 32 timer general register wu tgrwu 16 h'ffff8a32 16 timer general register w tgrw 16 h'ffff8a34 16, 32 timer general register wd tgrwd 16 h'ffff8a36 16 timer dead time counter 4 tdcnt4 16 h'ffff8a38 16, 32 timer dead time counter 5 tdcnt5 16 h'ffff8a3a 16 timer buffer register w_f tbrw_f 16 h'ffff8a3c 16 ? ? h'ffff8a3e to h'ffff8a4f ? instruction register sdir 16 h'ffff8a50 h-udi 8, 16, 32 status register sdsr 16 h'ffff8a52 8, 16 data register h sddrh 16 h'ffff8a54 8, 16, 32 data register l sddrl 16 h'ffff8a56 8, 16 ? ? h'ffff8a58 to h'ffff8fff in p cycles b: 2 w: 2 l: 4 master control register mcr 16 h'ffffb000 hcan2 16 general status register gsr 16 h'ffffb002 16 bit configuration register 1 hcan2_bcr1 16 h'ffffb004 16 bit configuration register 0 hcan2_bcr0 16 h'ffffb006 16 interrupt register irr 16 h'ffffb008 16 interrupt mask register imr 16 h'ffffb00a 16 transmit error counter tec 8 h'ffffb00c 16 receive error counter rec 8 h'ffffb00d in cycles b: 8 w: 8
rev. 2.00, 09/04, page 660 of 720 register name abbreviation bits address module access size access states transmit wait register 1 txpr1 16 h'ffffb020 hcan2 16 transmit wait register 0 txpr0 16 h'ffffb022 16 transmit wait cancel register 1 txcr1 16 h'ffffb028 16 transmit wait cancel register 0 txcr0 16 h'ffffb02a 16 transmit acknowledge register 1 txack1 16 h'ffffb030 16 transmit acknowledge register 0 txack0 16 h'ffffb032 16 cancel acknowledge register 1 aback1 16 h'ffffb038 16 cancel acknowledge register 0 aback0 16 h'ffffb03a 16 in cycles b: 8 w: 8 receive complete register 1 rxpr1 16 h'ffffb040 16 receive complete register 0 rxpr0 16 h'ffffb042 16 remote request register 1 rfpr1 16 h'ffffb048 16 remote request register 0 rfpr0 16 h'ffffb04a 16 mailbox interrupt mask regist er 1 mbimr1 16 h'ffffb050 16 mailbox interrupt mask regist er 0 mbimr0 16 h'ffffb052 16 ? ? ? h'ffffb054 to h'ffffb057 ? unread message status register 1 umsr1 16 h'ffffb058 16 unread message status register 2 umsr0 16 h'ffffb05a 16 ? ? ? h'ffffb05c to h'ffffb07f timer counter register tcntr 16 h'ffffb080 16 timer control register tcr 16 h'ffffb082 16 timer status register tsr 16 h'ffffb084 16 ? ? ? h'ffffb086, h'ffffb087 16 loyal offset register losr 16 h'ffffb088 16 input capture register 0 icr0 16 h'ffffb08c 16 input capture register 1 hcan2_icr1 16 h'ffffb08e 16 timer compare match register 0 tcmr0 16 h'ffffb090 16 timer compare match register 1 tcmr1 16 h'ffffb092 16 mailbox 0[0] mb0[0] 8 h'ffffb100 16 mailbox 0[1] mb0[1] 8 h'ffffb101 mailbox 0[2] mb0[2] 8 h'ffffb102 16 mailbox 0[3] mb0[3] 8 h'ffffb103 mailbox 0[4] mb0[4] 8 h'ffffb104 8, 16
rev. 2.00, 09/04, page 661 of 720 register name abbreviation bits address module access size access states mailbox 0[5] mb0[5] 8 h'ffffb105 hcan2 8 mailbox 0[6] mb0[6] 16 h'ffffb106 16 mailbox 0[7] mb0[7] 8 h'ffffb108 8, 16 mailbox 0[8] mb0[8] 8 h'ffffb109 8 mailbox 0[9] mb0[9] 8 h'ffffb10a 8, 16 mailbox 0[10] mb0[10] 8 h'ffffb10b 8 mailbox 0[11] mb0[11] 8 h'ffffb10c 8, 16 mailbox 0[12] mb0[12] 8 h'ffffb10d 8 mailbox 0[13] mb0[13] 8 h'ffffb10e 8, 16 mailbox 0[14] mb0[14] 8 h'ffffb10f 8 in cycles b: 8 w: 8 mailbox 0[15] mb0[15] 8 h'ffffb110 16 mailbox 0[16] mb0[16] 8 h'ffffb111 mailbox 0[17] mb0[17] 8 h'ffffb112 16 mailbox 0[18] mb0[18] 8 h'ffffb113 mailbox 1[0] mb1[0] 8 h'ffffb120 16 mailbox 1[1] mb1[1] 8 h'ffffb121 mailbox 1[2] mb1[2] 8 h'ffffb122 16 mailbox 1[3] mb1[3] 8 h'ffffb123 mailbox 1[4] mb1[4] 8 h'ffffb124 8, 16 mailbox 1[5] mb1[5] 8 h'ffffb125 8 mailbox 1[6] mb1[6] 16 h'ffffb126 16 mailbox 1[7] mb1[7] 8 h'ffffb128 8, 16 mailbox 1[8] mb1[8] 8 h'ffffb129 8 mailbox 1[9] mb1[9] 8 h'ffffb12a 8, 16 mailbox 1[10] mb1[10] 8 h'ffffb12b 8 mailbox 1[11] mb1[11] 8 h'ffffb12c 8, 16 mailbox 1[12] mb1[12] 8 h'ffffb12d 8 mailbox 1[13] mb1[13] 8 h'ffffb12e 8, 16 mailbox 1[14] mb1[14] 8 h'ffffb12f 8 mailbox 1[15] mb1[15] 8 h'ffffb130 16 mailbox 1[16] mb1[16] 8 h'ffffb131 mailbox 1[17] mb1[17] 8 h'ffffb132 16 mailbox 1[18] mb1[18] 8 h'ffffb133 mailbox 2[0] mb2[0] 8 h'ffffb140 16 mailbox 2[1] mb2[1] 8 h'ffffb141 mailbox 2[2] mb2[2] 8 h'ffffb142 16
rev. 2.00, 09/04, page 662 of 720 register name abbreviation bits address module access size access states mailbox 2[3] mb2[3] 8 h'ffffb143 hcan2 mailbox 2[4] mb2[4] 8 h'ffffb144 8, 16 mailbox 2[5] mb2[5] 8 h'ffffb145 8 mailbox 2[6] mb2[6] 16 h'ffffb146 16 mailbox 2[7] mb2[7] 8 h'ffffb148 8, 16 mailbox 2[8] mb2[8] 8 h'ffffb149 8 mailbox 2[9] mb2[9] 8 h'ffffb14a 8, 16 mailbox 2[10] mb2[10] 8 h'ffffb14b 8 mailbox 2[11] mb2[11] 8 h'ffffb14c 8, 16 mailbox 2[12] mb2[12] 8 h'ffffb14d 8 mailbox 2[13] mb2[13] 8 h'ffffb14e 8, 16 mailbox 2[14] mb2[14] 8 h'ffffb14f 8 mailbox 2[15] mb2[15] 8 h'ffffb150 16 mailbox 2[16] mb2[16] 8 h'ffffb151 mailbox 2[17] mb2[17] 8 h'ffffb152 16 mailbox 2[18] mb2[18] 8 h'ffffb153 mailbox 3[0] mb3[0] 8 h'ffffb160 16 mailbox 3[1] mb3[1] 8 h'ffffb161 mailbox 3[2] mb3[2] 8 h'ffffb162 16 mailbox 3[3] mb3[3] 8 h'ffffb163 mailbox 3[4] mb3[4] 8 h'ffffb164 8, 16 mailbox 3[5] mb3[5] 8 h'ffffb165 8 mailbox 3[6] mb3[6] 16 h'ffffb166 16 mailbox 3[7] mb3[7] 8 h'ffffb168 8, 16 mailbox 3[8] mb3[8] 8 h'ffffb169 8 mailbox 3[9] mb3[9] 8 h'ffffb16a 8, 16 mailbox 3[10] mb3[10] 8 h'ffffb16b 8 in cycles b: 8 w: 8 mailbox 3[11] mb3[11] 8 h'ffffb16c 8, 16 mailbox 3[12] mb3[12] 8 h'ffffb16d 8 mailbox 3[13] mb3[13] 8 h'ffffb16e 8, 16 mailbox 3[14] mb3[14] 8 h'ffffb16f 8 mailbox 3[15] mb3[15] 8 h'ffffb170 16 mailbox 3[16] mb3[16] 8 h'ffffb171 mailbox 3[17] mb3[17] 8 h'ffffb172 16 mailbox 3[18] mb3[18] 8 h'ffffb173 mailbox 4[0] mb4[0] 8 h'ffffb180 16
rev. 2.00, 09/04, page 663 of 720 register name abbreviation bits address module access size access states mailbox 4[1] mb4[1] 8 h'ffffb181 hcan2 mailbox 4[2] mb4[2] 8 h'ffffb182 16 mailbox 4[3] mb4[3] 8 h'ffffb183 mailbox 4[4] mb4[4] 8 h'ffffb184 8, 16 in cycles b: 8 w: 8 mailbox 4[5] mb4[5] 8 h'ffffb185 8 mailbox 4[6] mb4[6] 16 h'ffffb186 16 mailbox 4[7] mb4[7] 8 h'ffffb188 8, 16 mailbox 4[8] mb4[8] 8 h'ffffb189 8 mailbox 4[9] mb4[9] 8 h'ffffb18a 8, 16 mailbox 4[10] mb4[10] 8 h'ffffb18b 8 mailbox 4[11] mb4[11] 8 h'ffffb18c 8, 16 mailbox 4[12] mb4[12] 8 h'ffffb18d 8 mailbox 4[13] mb4[13] 8 h'ffffb18e 8, 16 mailbox 4[14] mb4[14] 8 h'ffffb18f 8 mailbox 4[15] mb4[15] 8 h'ffffb190 16 mailbox 4[16] mb4[16] 8 h'ffffb191 mailbox 4[17] mb4[17] 8 h'ffffb192 16 mailbox 4[18] mb4[18] 8 h'ffffb193 mailbox 5[0] mb5[0] 8 h'ffffb1a0 16 mailbox 5[1] mb5[1] 8 h'ffffb1a1 mailbox 5[2] mb5[2] 8 h'ffffb1a2 16 mailbox 5[3] mb5[3] 8 h'ffffb1a3 mailbox 5[4] mb5[4] 8 h'ffffb1a4 8, 16 mailbox 5[5] mb5[5] 8 h'ffffb1a5 8 mailbox 5[6] mb5[6] 16 h'ffffb1a6 16 mailbox 5[7] mb5[7] 8 h'ffffb1a8 8, 16 mailbox 5[8] mb5[8] 8 h'ffffb1a9 8 mailbox 5[9] mb5[9] 8 h'ffffb1aa 8, 16 mailbox 5[10] mb5[10] 8 h'ffffb1ab 8 mailbox 5[11] mb5[11] 8 h'ffffb1ac 8, 16 mailbox 5[12] mb5[12] 8 h'ffffb1ad 8 mailbox 5[13] mb5[13] 8 h'ffffb1ae 8, 16 mailbox 5[14] mb5[14] 8 h'ffffb1af 8 mailbox 5[15] mb5[15] 8 h'ffffb1b0 16 mailbox 5[16] mb5[16] 8 h'ffffb1b1 mailbox 5[17] mb5[17] 8 h'ffffb1b2 16
rev. 2.00, 09/04, page 664 of 720 register name abbreviation bits address module access size access states mailbox 5[18] mb5[18] 8 h'ffffb1b3 hcan2 mailbox 6[0] mb6[0] 8 h'ffffb1c0 16 mailbox 6[1] mb6[1] 8 h'ffffb1c1 in cycles b: 8 w: 8 mailbox 6[2] mb6[2] 8 h'ffffb1c2 16 mailbox 6[3] mb6[3] 8 h'ffffb1c3 mailbox 6[4] mb6[4] 8 h'ffffb1c4 8, 16 mailbox 6[5] mb6[5] 8 h'ffffb1c5 8 mailbox 6[6] mb6[6] 16 h'ffffb1c6 16 mailbox 6[7] mb6[7] 8 h'ffffb1c8 8, 16 mailbox 6[8] mb6[8] 8 h'ffffb1c9 8 mailbox 6[9] mb6[9] 8 h'ffffb1ca 8, 16 mailbox 6[10] mb6[10] 8 h'ffffb1cb 8 mailbox 6[11] mb6[11] 8 h'ffffb1cc 8, 16 mailbox 6[12] mb6[12] 8 h'ffffb1cd 8 mailbox 6[13] mb6[13] 8 h'ffffb1ce 8, 16 mailbox 6[14] mb6[14] 8 h'ffffb1cf 8 mailbox 6[15] mb6[15] 8 h'ffffb1d0 16 mailbox 6[16] mb6[16] 8 h'ffffb1d1 mailbox 6[17] mb6[17] 8 h'ffffb1d2 16 mailbox 6[18] mb6[18] 8 h'ffffb1d3 mailbox 7[0] mb7[0] 8 h'ffffb1e0 16 mailbox 7[1] mb7[1] 8 h'ffffb1e1 mailbox 7[2] mb7[2] 8 h'ffffb1e2 16 mailbox 7[3] mb7[3] 8 h'ffffb1e3 mailbox 7[4] mb7[4] 8 h'ffffb1e4 8, 16 mailbox 7[5] mb7[5] 8 h'ffffb1e5 8 mailbox 7[6] mb7[6] 16 h'ffffb1e6 16 mailbox 7[7] mb7[7] 8 h'ffffb1e8 8, 16 mailbox 7[8] mb7[8] 8 h'ffffb1e9 8 mailbox 7[9] mb7[9] 8 h'ffffb1ea 8, 16 mailbox 7[10] mb7[10] 8 h'ffffb1eb 8 mailbox 7[11] mb7[11] 8 h'ffffb1ec 8, 16 mailbox 7[12] mb7[12] 8 h'ffffb1ed 8 mailbox 7[13] mb7[13] 8 h'ffffb1ee 8, 16 mailbox 7[14] mb7[14] 8 h'ffffb1ef 8 mailbox 7[15] mb7[15] 8 h'ffffb1f0 16
rev. 2.00, 09/04, page 665 of 720 register name abbreviation bits address module access size access states mailbox 7[16] mb7[16] 8 h'ffffb1f1 hcan2 mailbox 7[17] mb7[17] 8 h'ffffb1f2 16 mailbox 7[18] mb7[18] 8 h'ffffb1f3 in cycles b: 8 w: 8 mailbox 8[0] mb8[0] 8 h'ffffb200 16 mailbox 8[1] mb8[1] 8 h'ffffb201 mailbox 8[2] mb8[2] 8 h'ffffb202 16 mailbox 8[3] mb8[3] 8 h'ffffb203 mailbox 8[4] mb8[4] 8 h'ffffb204 8, 16 mailbox 8[5] mb8[5] 8 h'ffffb205 8 mailbox 8[6] mb8[6] 16 h'ffffb206 16 mailbox 8[7] mb8[7] 8 h'ffffb208 8, 16 mailbox 8[8] mb8[8] 8 h'ffffb209 8 mailbox 8[9] mb8[9] 8 h'ffffb20a 8, 16 mailbox 8[10] mb8[10] 8 h'ffffb20b 8 mailbox 8[11] mb8[11] 8 h'ffffb20c 8, 16 mailbox 8[12] mb8[12] 8 h'ffffb20d 8 mailbox 8[13] mb8[13] 8 h'ffffb20e 8, 16 mailbox 8[14] mb8[14] 8 h'ffffb20f 8 mailbox 8[15] mb8[15] 8 h'ffffb210 16 mailbox 8[16] mb8[16] 8 h'ffffb211 mailbox 8[17] mb8[17] 8 h'ffffb212 16 mailbox 8[18] mb8[18] 8 h'ffffb213 mailbox 9[0] mb9[0] 8 h'ffffb220 16 mailbox 9[1] mb9[1] 8 h'ffffb221 mailbox 9[2] mb9[2] 8 h'ffffb222 16 mailbox 9[3] mb9[3] 8 h'ffffb223 mailbox 9[4] mb9[4] 8 h'ffffb224 8, 16 mailbox 9[5] mb9[5] 8 h'ffffb225 8 mailbox 9[6] mb9[6] 16 h'ffffb226 16 mailbox 9[7] mb9[7] 8 h'ffffb228 8, 16 mailbox 9[8] mb9[8] 8 h'ffffb229 8 mailbox 9[9] mb9[9] 8 h'ffffb22a 8, 16 mailbox 9[10] mb9[10] 8 h'ffffb22b 8 mailbox 9[11] mb9[11] 8 h'ffffb22c 8, 16 mailbox 9[12] mb9[12] 8 h'ffffb22d 8 mailbox 9[13] mb9[13] 8 h'ffffb22e 8, 16
rev. 2.00, 09/04, page 666 of 720 register name abbreviation bits address module access size access states mailbox 9[14] mb9[14] 8 h'ffffb22f hcan2 8 mailbox 9[15] mb9[15] 8 h'ffffb230 16 mailbox 9[16] mb9[16] 8 h'ffffb231 in cycles b: 8 w: 8 mailbox 9[17] mb9[17] 8 h'ffffb232 16 mailbox 9[18] mb9[18] 8 h'ffffb233 mailbox 10[0] mb10[0] 8 h'ffffb240 16 mailbox 10[1] mb10[1] 8 h'ffffb241 mailbox 10[2] mb10[2] 8 h'ffffb242 16 mailbox 10[3] mb10[3] 8 h'ffffb243 mailbox 10[4] mb10[4] 8 h'ffffb244 8, 16 mailbox 10[5] mb10[5] 8 h'ffffb245 8 mailbox 10[6] mb10[6] 16 h'ffffb246 16 mailbox 10[7] mb10[7] 8 h'ffffb248 8, 16 mailbox 10[8] mb10[8] 8 h'ffffb249 8 mailbox 10[9] mb10[9] 8 h'ffffb24a 8, 16 mailbox 10[10] mb10[10] 8 h'ffffb24b 8 mailbox 10[11] mb10[11] 8 h'ffffb24c 8, 16 mailbox 10[12] mb10[12] 8 h'ffffb24d 8 mailbox 10[13] mb10[13] 8 h'ffffb24e 8, 16 mailbox 10[14] mb10[14] 8 h'ffffb24f 8 mailbox 10[15] mb10[15] 8 h'ffffb250 16 mailbox 10[16] mb10[16] 8 h'ffffb251 mailbox 10[17] mb10[17] 8 h'ffffb252 16 mailbox 10[18] mb10[18] 8 h'ffffb253 mailbox 11[0] mb11[0] 8 h'ffffb260 16 mailbox 11[1] mb11[1] 8 h'ffffb261 mailbox 11[2] mb11[2] 8 h'ffffb262 16 mailbox 11[3] mb11[3] 8 h'ffffb263 mailbox 11[4] mb11[4] 8 h'ffffb264 8, 16 mailbox 11[5] mb11[5] 8 h'ffffb265 8 mailbox 11[6] mb11[6] 16 h'ffffb266 16 mailbox 11[7] mb11[7] 8 h'ffffb268 8, 16 mailbox 11[8] mb11[8] 8 h'ffffb269 8 mailbox 11[9] mb11[9] 8 h'ffffb26a 8, 16 mailbox 11[10] mb11[10] 8 h'ffffb26b 8 mailbox 11[11] mb11[11] 8 h'ffffb26c 8, 16
rev. 2.00, 09/04, page 667 of 720 register name abbreviation bits address module access size access states mailbox 11[12] mb11[12] 8 h'ffffb26d hcan2 8 mailbox 11[13] mb11[13] 8 h'ffffb26e 8, 16 mailbox 11[14] mb11[14] 8 h'ffffb26f 8 in cycles b: 8 w: 8 mailbox 11[15] mb11[15] 8 h'ffffb270 16 mailbox 11[16] mb11[16] 8 h'ffffb271 mailbox 11[17] mb11[17] 8 h'ffffb272 16 mailbox 11[18] mb11[18] 8 h'ffffb273 mailbox 12[0] mb12[0] 8 h'ffffb280 16 mailbox 12[1] mb12[1] 8 h'ffffb281 mailbox 12[2] mb12[2] 8 h'ffffb282 16 mailbox 12[3] mb12[3] 8 h'ffffb283 mailbox 12[4] mb12[4] 8 h'ffffb284 8, 16 mailbox 12[5] mb12[5] 8 h'ffffb285 8 mailbox 12[6] mb12[6] 16 h'ffffb286 16 mailbox 12[7] mb12[7] 8 h'ffffb288 8, 16 mailbox 12[8] mb12[8] 8 h'ffffb289 8 mailbox 12[9] mb12[9] 8 h'ffffb28a 8, 16 mailbox 12[10] mb12[10] 8 h'ffffb28b 8 mailbox 12[11] mb12[11] 8 h'ffffb28c 8, 16 mailbox 12[12] mb12[12] 8 h'ffffb28d 8 mailbox 12[13] mb12[13] 8 h'ffffb28e 8, 16 mailbox 12[14] mb12[14] 8 h'ffffb28f 8 mailbox 12[15] mb12[15] 8 h'ffffb290 16 mailbox 12[16] mb12[16] 8 h'ffffb291 mailbox 12[17] mb12[17] 8 h'ffffb292 16 mailbox 12[18] mb12[18] 8 h'ffffb293 mailbox 13[0] mb13[0] 8 h'ffffb2a0 16 mailbox 13[1] mb13[1] 8 h'ffffb2a1 mailbox 13[2] mb13[2] 8 h'ffffb2a2 16 mailbox 13[3] mb13[3] 8 h'ffffb2a3 mailbox 13[4] mb13[4] 8 h'ffffb2a4 8, 16 mailbox 13[5] mb13[5] 8 h'ffffb2a5 8 mailbox 13[6] mb13[6] 16 h'ffffb2a6 16 mailbox 13[7] mb13[7] 8 h'ffffb2a8 8, 16 mailbox 13[8] mb13[8] 8 h'ffffb2a9 8 mailbox 13[9] mb13[9] 8 h'ffffb2aa 8, 16
rev. 2.00, 09/04, page 668 of 720 register name abbreviation bits address module access size access states mailbox 13[10] mb13[10] 8 h'ffffb2ab hcan2 8 mailbox 13[11] mb13[11] 8 h'ffffb2ac 8, 16 mailbox 13[12] mb13[12] 8 h'ffffb2ad 8 in cycles b: 8 w: 8 mailbox 13[13] mb13[13] 8 h'ffffb2ae 8, 16 mailbox 13[14] mb13[14] 8 h'ffffb2af 8 mailbox 13[15] mb13[15] 8 h'ffffb2b0 16 mailbox 13[16] mb13[16] 8 h'ffffb2b1 mailbox 13[17] mb13[17] 8 h'ffffb2b2 16 mailbox 13[18] mb13[18] 8 h'ffffb2b3 mailbox 14[0] mb14[0] 8 h'ffffb2c0 16 mailbox 14[1] mb14[1] 8 h'ffffb2c1 mailbox 14[2] mb14[2] 8 h'ffffb2c2 16 mailbox 14[3] mb14[3] 8 h'ffffb2c3 mailbox 14[4] mb14[4] 8 h'ffffb2c4 8, 16 mailbox 14[5] mb14[5] 8 h'ffffb2c5 8 mailbox 14[6] mb14[6] 16 h'ffffb2c6 16 mailbox 14[7] mb14[7] 8 h'ffffb2c8 8, 16 mailbox 14[8] mb14[8] 8 h'ffffb2c9 8 mailbox 14[9] mb14[9] 8 h'ffffb2ca 8, 16 mailbox 14[10] mb14[10] 8 h'ffffb2cb 8 mailbox 14[11] mb14[11] 8 h'ffffb2cc 8, 16 mailbox 14[12] mb14[12] 8 h'ffffb2cd 8 mailbox 14[13] mb14[13] 8 h'ffffb2ce 8, 16 mailbox 14[14] mb14[14] 8 h'ffffb2cf 8 mailbox 14[15] mb14[15] 8 h'ffffb2d0 16 mailbox 14[16] mb14[16] 8 h'ffffb2d1 mailbox 14[17] mb14[17] 8 h'ffffb2d2 16 mailbox 14[18] mb14[18] 8 h'ffffb2d3 mailbox 15[0] mb15[0] 8 h'ffffb2e0 16 mailbox 15[1] mb15[1] 8 h'ffffb2e1 mailbox 15[2] mb15[2] 8 h'ffffb2e2 16 mailbox 15[3] mb15[3] 8 h'ffffb2e3 mailbox 15[4] mb15[4] 8 h'ffffb2e4 8, 16 mailbox 15[5] mb15[5] 8 h'ffffb2e5 8 mailbox 15[6] mb15[6] 16 h'ffffb2e6 16 mailbox 15[7] mb15[7] 8 h'ffffb2e8 8, 16
rev. 2.00, 09/04, page 669 of 720 register name abbreviation bits address module access size access states mailbox 15[8] mb15[8] 8 h'ffffb2e9 hcan2 8 mailbox 15[9] mb15[9] 8 h'ffffb2ea 8, 16 mailbox 15[10] mb15[10] 8 h'ffffb2eb 8 in cycles b: 8 w: 8 mailbox 15[11] mb15[11] 8 h'ffffb2ec 8, 16 mailbox 15[12] mb15[12] 8 h'ffffb2ed 8 mailbox 15[13] mb15[13] 8 h'ffffb2ee 8, 16 mailbox 15[14] mb15[14] 8 h'ffffb2ef 8 mailbox 15[15] mb15[15] 8 h'ffffb2f0 16 mailbox 15[16] mb15[16] 8 h'ffffb2f1 mailbox 15[17] mb15[17] 8 h'ffffb2f2 16 mailbox 15[18] mb15[18] 8 h'ffffb2f3 mailbox 16[0] mb16[0] 8 h'ffffb300 16 mailbox 16[1] mb16[1] 8 h'ffffb301 mailbox 16[2] mb16[2] 8 h'ffffb302 16 mailbox 16[3] mb16[3] 8 h'ffffb303 mailbox 16[4] mb16[4] 8 h'ffffb304 8, 16 mailbox 16[5] mb16[5] 8 h'ffffb305 8 mailbox 16[6] mb16[6] 16 h'ffffb306 16 mailbox 16[7] mb16[7] 8 h'ffffb308 8, 16 mailbox 16[8] mb16[8] 8 h'ffffb309 8 mailbox 16[9] mb16[9] 8 h'ffffb30a 8, 16 mailbox 16[10] mb16[10] 8 h'ffffb30b 8 mailbox 16[11] mb16[11] 8 h'ffffb30c 8, 16 mailbox 16[12] mb16[12] 8 h'ffffb30d 8 mailbox 16[13] mb16[13] 8 h'ffffb30e 8, 16 mailbox 16[14] mb16[14] 8 h'ffffb30f 8 mailbox 16[15] mb16[15] 8 h'ffffb310 16 mailbox 16[16] mb16[16] 8 h'ffffb311 mailbox 16[17] mb16[17] 8 h'ffffb312 16 mailbox 16[18] mb16[18] 8 h'ffffb313 mailbox 17[0] mb17[0] 8 h'ffffb320 16 mailbox 17[1] mb17[1] 8 h'ffffb321 mailbox 17[2] mb17[2] 8 h'ffffb322 16 mailbox 17[3] mb17[3] 8 h'ffffb323 mailbox 17[4] mb17[4] 8 h'ffffb324 8, 16 mailbox 17[5] mb17[5] 8 h'ffffb325 8
rev. 2.00, 09/04, page 670 of 720 register name abbreviation bits address module access size access states mailbox 17[6] mb17[6] 16 h'ffffb326 hcan2 16 mailbox 17[7] mb17[7] 8 h'ffffb328 8, 16 mailbox 17[8] mb17[8] 8 h'ffffb329 8 in cycles b: 8 w: 8 mailbox 17[9] mb17[9] 8 h'ffffb32a 8, 16 mailbox 17[10] mb17[10] 8 h'ffffb32b 8 mailbox 17[11] mb17[11] 8 h'ffffb32c 8, 16 mailbox 17[12] mb17[12] 8 h'ffffb32d 8 mailbox 17[13] mb17[13] 8 h'ffffb32e 8, 16 mailbox 17[14] mb17[14] 8 h'ffffb32f 8 mailbox 17[15] mb17[15] 8 h'ffffb330 16 mailbox 17[16] mb17[16] 8 h'ffffb331 mailbox 17[17] mb17[17] 8 h'ffffb332 16 mailbox 17[18] mb17[18] 8 h'ffffb333 mailbox 18[0] mb18[0] 8 h'ffffb340 16 mailbox 18[1] mb18[1] 8 h'ffffb341 mailbox 18[2] mb18[2] 8 h'ffffb342 16 mailbox 18[3] mb18[3] 8 h'ffffb343 mailbox 18[4] mb18[4] 8 h'ffffb344 8, 16 mailbox 18[5] mb18[5] 8 h'ffffb345 8 mailbox 18[6] mb18[6] 16 h'ffffb346 16 mailbox 18[7] mb18[7] 8 h'ffffb348 8, 16 mailbox 18[8] mb18[8] 8 h'ffffb349 8 mailbox 18[9] mb18[9] 8 h'ffffb34a 8, 16 mailbox 18[10] mb18[10] 8 h'ffffb34b 8 mailbox 18[11] mb18[11] 8 h'ffffb34c 8, 16 mailbox 18[12] mb18[12] 8 h'ffffb34d 8 mailbox 18[13] mb18[13] 8 h'ffffb34e 8, 16 mailbox 18[14] mb18[14] 8 h'ffffb34f 8 mailbox 18[15] mb18[15] 8 h'ffffb350 16 mailbox 18[16] mb18[16] 8 h'ffffb351 mailbox 18[17] mb18[17] 8 h'ffffb352 16 mailbox 18[18] mb18[18] 8 h'ffffb353 mailbox 19[0] mb19[0] 8 h'ffffb360 16 mailbox 19[1] mb19[1] 8 h'ffffb361 mailbox 19[2] mb19[2] 8 h'ffffb362 16 mailbox 19[3] mb19[3] 8 h'ffffb363
rev. 2.00, 09/04, page 671 of 720 register name abbreviation bits address module access size access states mailbox 19[4] mb19[4] 8 h'ffffb364 hcan2 8, 16 mailbox 19[5] mb19[5] 8 h'ffffb365 8 mailbox 19[6] mb19[6] 16 h'ffffb366 16 in cycles b: 8 w: 8 mailbox 19[7] mb19[7] 8 h'ffffb368 8, 16 mailbox 19[8] mb19[8] 8 h'ffffb369 8 mailbox 19[9] mb19[9] 8 h'ffffb36a 8, 16 mailbox 19[10] mb19[10] 8 h'ffffb36b 8 mailbox 19[11] mb19[11] 8 h'ffffb36c 8, 16 mailbox 19[12] mb19[12] 8 h'ffffb36d 8 mailbox 19[13] mb19[13] 8 h'ffffb36e 8, 16 mailbox 19[14] mb19[14] 8 h'ffffb36f 8 mailbox 19[15] mb19[15] 8 h'ffffb370 16 mailbox 19[16] mb19[16] 8 h'ffffb371 mailbox 19[17] mb19[17] 8 h'ffffb372 16 mailbox 19[18] mb19[18] 8 h'ffffb373 mailbox 20[0] mb20[0] 8 h'ffffb380 16 mailbox 20[1] mb20[1] 8 h'ffffb381 mailbox 20[2] mb20[2] 8 h'ffffb382 16 mailbox 20[3] mb20[3] 8 h'ffffb383 mailbox 20[4] mb20[4] 8 h'ffffb384 8, 16 mailbox 20[5] mb20[5] 8 h'ffffb385 8 mailbox 20[6] mb20[6] 16 h'ffffb386 16 mailbox 20[7] mb20[7] 8 h'ffffb388 8, 16 mailbox 20[8] mb20[8] 8 h'ffffb389 8 mailbox 20[9] mb20[9] 8 h'ffffb38a 8, 16 mailbox 20[10] mb20[10] 8 h'ffffb38b 8 mailbox 20[11] mb20[11] 8 h'ffffb38c 8, 16 mailbox 20[12] mb20[12] 8 h'ffffb38d 8 mailbox 20[13] mb20[13] 8 h'ffffb38e 8, 16 mailbox 20[14] mb20[14] 8 h'ffffb38f 8 mailbox 20[15] mb20[15] 8 h'ffffb390 16 mailbox 20[16] mb20[16] 8 h'ffffb391 mailbox 20[17] mb20[17] 8 h'ffffb392 16 mailbox 20[18] mb20[18] 8 h'ffffb393 mailbox 21[0] mb21[0] 8 h'ffffb3a0 16 mailbox 21[1] mb21[1] 8 h'ffffb3a1
rev. 2.00, 09/04, page 672 of 720 register name abbreviation bits address module access size access states mailbox 21[2] mb21[2] 8 h'ffffb3a2 hcan2 16 mailbox 21[3] mb21[3] 8 h'ffffb3a3 mailbox 21[4] mb21[4] 8 h'ffffb3a4 8, 16 in cycles b: 8 w: 8 mailbox 21[5] mb21[5] 8 h'ffffb3a5 8 mailbox 21[6] mb21[6] 16 h'ffffb3a6 16 mailbox 21[7] mb21[7] 8 h'ffffb3a8 8, 16 mailbox 21[8] mb21[8] 8 h'ffffb3a9 8 mailbox 21[9] mb21[9] 8 h'ffffb3aa 8, 16 mailbox 21[10] mb21[10] 8 h'ffffb3ab 8 mailbox 21[11] mb21[11] 8 h'ffffb3ac 8, 16 mailbox 21[12] mb21[12] 8 h'ffffb3ad 8 mailbox 21[13] mb21[13] 8 h'ffffb3ae 8, 16 mailbox 21[14] mb21[14] 8 h'ffffb3af 8 mailbox 21[15] mb21[15] 8 h'ffffb3b0 16 mailbox 21[16] mb21[16] 8 h'ffffb3b1 mailbox 21[17] mb21[17] 8 h'ffffb3b2 16 mailbox 21[18] mb21[18] 8 h'ffffb3b3 mailbox 22[0] mb22[0] 8 h'ffffb3c0 16 mailbox 22[1] mb22[1] 8 h'ffffb3c1 mailbox 22[2] mb22[2] 8 h'ffffb3c2 16 mailbox 22[3] mb22[3] 8 h'ffffb3c3 mailbox 22[4] mb22[4] 8 h'ffffb3c4 8, 16 mailbox 22[5] mb22[5] 8 h'ffffb3c5 8 mailbox 22[6] mb22[6] 16 h'ffffb3c6 16 mailbox 22[7] mb22[7] 8 h'ffffb3c8 8, 16 mailbox 22[8] mb22[8] 8 h'ffffb3c9 8 mailbox 22[9] mb22[9] 8 h'ffffb3ca 8, 16 mailbox 22[10] mb22[10] 8 h'ffffb3cb 8 mailbox 22[11] mb22[11] 8 h'ffffb3cc 8, 16 mailbox 22[12] mb22[12] 8 h'ffffb3cd 8 mailbox 22[13] mb22[13] 8 h'ffffb3ce 8, 16 mailbox 22[14] mb22[14] 8 h'ffffb3cf 8 mailbox 22[15] mb22[15] 8 h'ffffb3d0 16 mailbox 22[16] mb22[16] 8 h'ffffb3d1 mailbox 22[17] mb22[17] 8 h'ffffb3d2 16 mailbox 22[18] mb22[18] 8 h'ffffb3d3
rev. 2.00, 09/04, page 673 of 720 register name abbreviation bits address module access size access states mailbox 23[0] mb23[0] 8 h'ffffb3e0 hcan2 16 mailbox 23[1] mb23[1] 8 h'ffffb3e1 mailbox 23[2] mb23[2] 8 h'ffffb3e2 16 in cycles b: 8 w: 8 mailbox 23[3] mb23[3] 8 h'ffffb3e3 mailbox 23[4] mb23[4] 8 h'ffffb3e4 8, 16 mailbox 23[5] mb23[5] 8 h'ffffb3e5 8 mailbox 23[6] mb23[6] 16 h'ffffb3e6 16 mailbox 23[7] mb23[7] 8 h'ffffb3e8 8, 16 mailbox 23[8] mb23[8] 8 h'ffffb3e9 8 mailbox 23[9] mb23[9] 8 h'ffffb3ea 8, 16 mailbox 23[10] mb23[10] 8 h'ffffb3eb 8 mailbox 23[11] mb23[11] 8 h'ffffb3ec 8, 16 mailbox 23[12] mb23[12] 8 h'ffffb3ed 8 mailbox 23[13] mb23[13] 8 h'ffffb3ee 8, 16 mailbox 23[14] mb23[14] 8 h'ffffb3ef 8 mailbox 23[15] mb23[15] 8 h'ffffb3f0 16 mailbox 23[16] mb23[16] 8 h'ffffb3f1 mailbox 23[17] mb23[17] 8 h'ffffb3f2 16 mailbox 23[18] mb23[18] 8 h'ffffb3f3 mailbox 24[0] mb24[0] 8 h'ffffb400 16 mailbox 24[1] mb24[1] 8 h'ffffb401 mailbox 24[2] mb24[2] 8 h'ffffb402 16 mailbox 24[3] mb24[3] 8 h'ffffb403 mailbox 24[4] mb24[4] 8 h'ffffb404 8, 16 mailbox 24[5] mb24[5] 8 h'ffffb405 8 mailbox 24[6] mb24[6] 16 h'ffffb406 16 mailbox 24[7] mb24[7] 8 h'ffffb408 8, 16 mailbox 24[8] mb24[8] 8 h'ffffb409 8 mailbox 24[9] mb24[9] 8 h'ffffb40a 8, 16 mailbox 24[10] mb24[10] 8 h'ffffb40b 8 mailbox 24[11] mb24[11] 8 h'ffffb40c 8, 16 mailbox 24[12] mb24[12] 8 h'ffffb40d 8 mailbox 24[13] mb24[13] 8 h'ffffb40e 8, 16 mailbox 24[14] mb24[14] 8 h'ffffb40f 8 mailbox 24[15] mb24[15] 8 h'ffffb410 16 mailbox 24[16] mb24[16] 8 h'ffffb411
rev. 2.00, 09/04, page 674 of 720 register name abbreviation bits address module access size access states mailbox 24[17] mb24[17] 8 h'ffffb412 hcan2 16 mailbox 24[18] mb24[18] 8 h'ffffb413 mailbox 25[0] mb25[0] 8 h'ffffb420 16 in cycles b: 8 w: 8 mailbox 25[1] mb25[1] 8 h'ffffb421 mailbox 25[2] mb25[2] 8 h'ffffb422 16 mailbox 25[3] mb25[3] 8 h'ffffb423 mailbox 25[4] mb25[4] 8 h'ffffb424 8, 16 mailbox 25[5] mb25[5] 8 h'ffffb425 8 mailbox 25[6] mb25[6] 16 h'ffffb426 16 mailbox 25[7] mb25[7] 8 h'ffffb428 8, 16 mailbox 25[8] mb25[8] 8 h'ffffb429 8 mailbox 25[9] mb25[9] 8 h'ffffb42a 8, 16 mailbox 25[10] mb25[10] 8 h'ffffb42b 8 mailbox 25[11] mb25[11] 8 h'ffffb42c 8, 16 mailbox 25[12] mb25[12] 8 h'ffffb42d 8 mailbox 25[13] mb25[13] 8 h'ffffb42e 8, 16 mailbox 25[14] mb25[14] 8 h'ffffb42f 8 mailbox 25[15] mb25[15] 8 h'ffffb430 16 mailbox 25[16] mb25[16] 8 h'ffffb431 mailbox 25[17] mb25[17] 8 h'ffffb432 16 mailbox 25[18] mb25[18] 8 h'ffffb433 mailbox 26[0] mb26[0] 8 h'ffffb440 16 mailbox 26[1] mb26[1] 8 h'ffffb441 mailbox 26[2] mb26[2] 8 h'ffffb442 16 mailbox 26[3] mb26[3] 8 h'ffffb443 mailbox 26[4] mb26[4] 8 h'ffffb444 8, 16 mailbox 26[5] mb26[5] 8 h'ffffb445 8 mailbox 26[6] mb26[6] 16 h'ffffb446 16 mailbox 26[7] mb26[7] 8 h'ffffb448 8, 16 mailbox 26[8] mb26[8] 8 h'ffffb449 8 mailbox 26[9] mb26[9] 8 h'ffffb44a 8, 16 mailbox 26[10] mb26[10] 8 h'ffffb44b 8 mailbox 26[11] mb26[11] 8 h'ffffb44c 8, 16 mailbox 26[12] mb26[12] 8 h'ffffb44d 8 mailbox 26[13] mb26[13] 8 h'ffffb44e 8, 16 mailbox 26[14] mb26[14] 8 h'ffffb44f 8
rev. 2.00, 09/04, page 675 of 720 register name abbreviation bits address module access size access states mailbox 26[15] mb26[15] 8 h'ffffb450 hcan2 16 mailbox 26[16] mb26[16] 8 h'ffffb451 mailbox 26[17] mb26[17] 8 h'ffffb452 16 in cycles b: 8 w: 8 mailbox 26[18] mb26[18] 8 h'ffffb453 mailbox 27[0] mb27[0] 8 h'ffffb460 16 mailbox 27[1] mb27[1] 8 h'ffffb461 mailbox 27[2] mb27[2] 8 h'ffffb462 16 mailbox 27[3] mb27[3] 8 h'ffffb463 mailbox 27[4] mb27[4] 8 h'ffffb464 8, 16 mailbox 27[5] mb27[5] 8 h'ffffb465 8 mailbox 27[6] mb27[6] 16 h'ffffb466 16 mailbox 27[7] mb27[7] 8 h'ffffb468 8, 16 mailbox 27[8] mb27[8] 8 h'ffffb469 8 mailbox 27[9] mb27[9] 8 h'ffffb46a 8, 16 mailbox 27[10] mb27[10] 8 h'ffffb46b 8 mailbox 27[11] mb27[11] 8 h'ffffb46c 8, 16 mailbox 27[12] mb27[12] 8 h'ffffb46d 8 mailbox 27[13] mb27[13] 8 h'ffffb46e 8, 16 mailbox 27[14] mb27[14] 8 h'ffffb46f 8 mailbox 27[15] mb27[15] 8 h'ffffb470 16 mailbox 27[16] mb27[16] 8 h'ffffb471 mailbox 27[17] mb27[17] 8 h'ffffb472 16 mailbox 27[18] mb27[18] 8 h'ffffb473 mailbox 28[0] mb28[0] 8 h'ffffb480 16 mailbox 28[1] mb28[1] 8 h'ffffb481 mailbox 28[2] mb28[2] 8 h'ffffb482 16 mailbox 28[3] mb28[3] 8 h'ffffb483 mailbox 28[4] mb28[4] 8 h'ffffb484 8, 16 mailbox 28[5] mb28[5] 8 h'ffffb485 8 mailbox 28[6] mb28[6] 16 h'ffffb486 16 mailbox 28[7] mb28[7] 8 h'ffffb488 8, 16 mailbox 28[8] mb28[8] 8 h'ffffb489 8 mailbox 28[9] mb28[9] 8 h'ffffb48a 8, 16 mailbox 28[10] mb28[10] 8 h'ffffb48b 8 mailbox 28[11] mb28[11] 8 h'ffffb48c 8, 16 mailbox 28[12] mb28[12] 8 h'ffffb48d 8
rev. 2.00, 09/04, page 676 of 720 register name abbreviation bits address module access size access states mailbox 28[13] mb28[13] 8 h'ffffb48e hcan2 8, 16 mailbox 28[14] mb28[14] 8 h'ffffb48f 8 mailbox 28[15] mb28[15] 8 h'ffffb490 16 in cycles b: 8 w: 8 mailbox 28[16] mb28[16] 8 h'ffffb491 mailbox 28[17] mb28[17] 8 h'ffffb492 16 mailbox 28[18] mb28[18] 8 h'ffffb493 mailbox 29[0] mb29[0] 8 h'ffffb4a0 16 mailbox 29[1] mb29[1] 8 h'ffffb4a1 mailbox 29[2] mb29[2] 8 h'ffffb4a2 16 mailbox 29[3] mb29[3] 8 h'ffffb4a3 mailbox 29[4] mb29[4] 8 h'ffffb4a4 8, 16 mailbox 29[5] mb29[5] 8 h'ffffb4a5 8 mailbox 29[6] mb29[6] 16 h'ffffb4a6 16 mailbox 29[7] mb29[7] 8 h'ffffb4a8 8, 16 mailbox 29[8] mb29[8] 8 h'ffffb4a9 8 mailbox 29[9] mb29[9] 8 h'ffffb4aa 8, 16 mailbox 29[10] mb29[10] 8 h'ffffb4ab 8 mailbox 29[11] mb29[11] 8 h'ffffb4ac 8, 16 mailbox 29[12] mb29[12] 8 h'ffffb4ad 8 mailbox 29[13] mb29[13] 8 h'ffffb4ae 8, 16 mailbox 29[14] mb29[14] 8 h'ffffb4af 8 mailbox 29[15] mb29[15] 8 h'ffffb4b0 16 mailbox 29[16] mb29[16] 8 h'ffffb4b1 mailbox 29[17] mb29[17] 8 h'ffffb4b2 16 mailbox 29[18] mb29[18] 8 h'ffffb4b3 mailbox 30[0] mb30[0] 8 h'ffffb4c0 16 mailbox 30[1] mb30[1] 8 h'ffffb4c1 mailbox 30[2] mb30[2] 8 h'ffffb4c2 16 mailbox 30[3] mb30[3] 8 h'ffffb4c3 mailbox 30[4] mb30[4] 8 h'ffffb4c4 8, 16 mailbox 30[5] mb30[5] 8 h'ffffb4c5 8 mailbox 30[6] mb30[6] 16 h'ffffb4c6 16 mailbox 30[7] mb30[7] 8 h'ffffb4c8 8, 16 mailbox 30[8] mb30[8] 8 h'ffffb4c9 8 mailbox 30[9] mb30[9] 8 h'ffffb4ca 8, 16 mailbox 30[10] mb30[10] 8 h'ffffb4cb 8
rev. 2.00, 09/04, page 677 of 720 register name abbreviation bits address module access size access states mailbox 30[11] mb30[11] 8 h'ffffb4cc hcan2 8, 16 mailbox 30[12] mb30[12] 8 h'ffffb4cd 8 mailbox 30[13] mb30[13] 8 h'ffffb4ce 8, 16 in cycles b: 8 w: 8 mailbox 30[14] mb30[14] 8 h'ffffb4cf 8 mailbox 30[15] mb30[15] 8 h'ffffb4d0 16 mailbox 30[16] mb30[16] 8 h'ffffb4d1 mailbox 30[17] mb30[17] 8 h'ffffb4d2 16 mailbox 30[18] mb30[18] 8 h'ffffb4d3 mailbox 31[0] mb31[0] 8 h'ffffb4e0 16 mailbox 31[1] mb31[1] 8 h'ffffb4e1 mailbox 31[2] mb31[2] 8 h'ffffb4e2 16 mailbox 31[3] mb31[3] 8 h'ffffb4e3 mailbox 31[4] mb31[4] 8 h'ffffb4e4 8, 16 mailbox 31[5] mb31[5] 8 h'ffffb4e5 8 mailbox 31[6] mb31[6] 16 h'ffffb4e6 16 mailbox 31[7] mb31[7] 8 h'ffffb4e8 8, 16 mailbox 31[8] mb31[8] 8 h'ffffb4e9 8 mailbox 31[9] mb31[9] 8 h'ffffb4ea 8, 16 mailbox 31[10] mb31[10] 8 h'ffffb4eb 8 mailbox 31[11] mb31[11] 8 h'ffffb4ec 8, 16 mailbox 31[12] mb31[12] 8 h'ffffb4ed 8 mailbox 31[13] mb31[13] 8 h'ffffb4ee 8, 16 mailbox 31[14] mb31[14] 8 h'ffffb4ef 8 mailbox 31[15] mb31[15] 8 h'ffffb4f0 16 mailbox 31[16] mb31[16] 8 h'ffffb4f1 mailbox 31[17] mb31[17] 8 h'ffffb4f2 16 mailbox 31[18] mb31[18] 8 h'ffffb4f3
rev. 2.00, 09/04, page 678 of 720 a.2 register bits internal peripheral module register addresses an d bit names are shown in the following table. 16-bit and 32-bit registers are shown in two and four rows of 8 bits, respectively. register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module smr_2 c/ a chr pe o/ e stop mp cks1 cks0 brr_2 scr_2 tie rie te re mpie teie cke1 cke0 tdr_2 ssr_2 tdre rdrf orer fer per tend mpb mpbt sci (channel 2) rdr_2 sdcr_2 ? ? ? ? dir ? ? ? smr_3 c/ a chr pe o/ e stop mp cks1 cks0 brr_3 scr_3 tie rie te re mpie teie cke1 cke0 tdr_3 ssr_3 tdre rdrf orer fer per tend mpb mpbt sci (channel 3) rdr_3 sdcr_3 ? ? ? ? dir ? ? ? smr_4 c/ a chr pe o/ e stop mp cks1 cks0 brr_4 scr_4 tie rie te re mpie teie cke1 cke0 tdr_4 ssr_4 tdre rdrf orer fer per tend mpb mpbt sci (channel 4) rdr_4 sdcr_4 ? ? ? ? dir ? ? ? ? ? ? ? ? ? ? ? ? ? tcr_3 cclr2 cclr1 cclr0 ckeg 1 ckeg0 tpsc2 tpsc1 tpsc0 tcr_4 cclr2 cclr1 cclr0 ckeg 1 ckeg0 tpsc2 tpsc1 tpsc0 tmdr_3 ? ? bfb bfa md3 md2 md1 md0 tmdr_4 ? ? bfb bfa md3 md2 md1 md0 tiorh_3 iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 tiorl_3 iod3 iod2 iod1 iod0 ioc3 ioc2 ioc1 ioc0 tiorh_4 iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 tiorl_4 iod3 iod2 iod1 iod0 ioc3 ioc2 ioc1 ioc0 tier_3 ttge ? ? tciev tgied tgiec tgieb tgiea tier_4 ttge ? ? tciev tgied tgiec tgieb tgiea mtu (channels 3 and 4) toer ? ? oe4d oe4c oe3d oe4b oe4a oe3b
rev. 2.00, 09/04, page 679 of 720 register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module tocr ? psye ? ? ? ? olsn olsp tgcr ? bdc n p fb wf vf uf mtu (channels 3 and 4) tcnt_3 tcnt_4 tcdr tddr tgra_3 tgrb_3 tgra_4 tgrb_4 tcnts tcbr tgrc_3 tgrd_3 tgrc_4 tgrd_4 tsr_3 tcfd ? ? tcfv tgfd tgfc tgfb tgfa tsr_4 tcfd ? ? tcfv tgfd tgfc tgfb tgfa tstr cst4 cst3 ? ? ? cst2 cst1 cst0 tsyr sync4 sync3 ? ? ? sync2 sync1 sync0 tcr_0 cclr2 cclr1 cclr0 ckeg 1 ckeg0 tpsc2 tpsc1 tpsc0 tmdr_0 ? ? bfb bfa md3 md2 md1 md0 mtu (channel 0) tiorh_0 iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 tiorl_0 iod3 iod2 iod1 iod0 ioc3 ioc2 ioc1 ioc0 tier_0 ttge ? ? tciev tgied tgiec tgieb tgiea
rev. 2.00, 09/04, page 680 of 720 register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module tsr_0 ? ? ? tcfv tgfd tgfc tgfb tgfa mtu (channel 0) tcnt_0 tgra_0 tgrb_0 tgrc_0 tgrd_0 tcr_1 ? cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 tmdr_1 ? ? ? ? md3 md2 md1 md0 tior_1 iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 tier_1 ttge ? tcieu tciev ? ? tgieb tgiea tsr_1 tcfd ? tcfu tcfv ? ? tgfb tgfa tcnt_1 tgra_1 tgrb_1 mtu (channel 1) tcr_2 ? cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 tmdr_2 ? ? ? ? md3 md2 md1 md0 tior_2 iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 tier_2 ttge ? tcieu tciev ? ? tgieb tgiea tsr_2 tcfd ? tcfu tcfv ? ? tgfb tgfa tcnt_2 tgra_2 tgrb_2 mtu (channel 2) ? ? ? ? ? ? ? ? ? ? irq0 irq0 irq0 irq0 irq1 irq1 irq1 irq1 ipra irq2 irq2 irq2 irq2 irq3 irq3 irq3 irq3 intc iprd mtu0 mtu0 mtu0 mtu0 mtu0 mtu0 mtu0 mtu0 mtu1 mtu1 mtu1 mtu1 mtu1 mtu1 mtu1 mtu1
rev. 2.00, 09/04, page 681 of 720 register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module mtu2 mtu2 mtu2 mtu2 mtu2 mtu2 mtu2 mtu2 intc ipre mtu3 mtu3 mtu3 mtu3 mt u3 mtu3 mtu3 mtu3 mtu4 mtu4 mtu4 mtu4 mt u4 mtu4 mtu4 mtu4 iprf ? ? ? ? ? ? ? ? a/d0,1 a/d0,1 a/d0,1 a/d0,1 dtc dtc dtc dtc iprg cmt0 cmt0 cmt0 cmt0 cmt1 cmt1 cmt1 cmt1 wdt wdt wdt wdt i/o(mtu) i/o(mtu) i/o(mtu) i/o(mtu) iprh ? ? ? ? ? ? ? ? nmil ? ? ? ? ? ? nmie icr1 irq0s irq1s irq2s irq3s ? ? ? ? ? ? ? ? ? ? ? ? isr irq0f irq1f irq2f irq3f ? ? ? ? sci2 sci2 sci2 sci2 sci3 sci3 sci3 sci3 ipri sci4 sci4 sci4 sci4 mmt mmt mmt mmt i/o(mmt) i/o(mmt) i/o(mmt) i/o(mmt) ? ? ? ? iprk hcan2 hcan2 hcan2 hcan2 ? ? ? ? irq0es1 irq0es0 irq1es1 irq1es0 irq2es1 irq2es0 irq3es1 irq3es0 icr2 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? pa15dr pa14dr pa13dr pa12dr pa11dr pa10dr pa9dr pa8dr port a padrl pa7dr pa6dr pa5dr pa4dr pa3dr pa2dr pa1dr pa0dr paiorl pa15ior pa14ior pa13ior pa12i or pa11ior pa10ior pa9ior pa8ior pa7ior pa6ior pa5ior pa4ior pa3ior pa2ior pa1ior pa0ior pa15md2 pa14md2 pa13md2 pa12md2 pa11md2 pa10md2 pa9md2 pa8md2 pacrl3 pa7md2 pa6md2 pa5md2 pa4md2 pa3md2 pa2md2 pa1md2 pa0md2 pa15md1 pa15md0 pa14md1 pa14md0 pa13md1 pa13md0 pa12md1 pa12md0 pacrl1 pa11md1 pa11md0 pa10md1 pa10md0 pa9md1 pa9md0 pa8md1 pa8md0 pacrl2 pa7md1 pa7md0 pa6md1 pa6md 0 pa5md1 pa5md0 pa4md1 pa4md0 pa3md1 pa3md0 pa2md1 pa2md0 pa1md1 pa1md0 pa0md1 pa0md0 ? ? ? ? ? ? ? ? port b pbdr ? ? pb5dr pb4dr pb3dr pb2dr pb1dr pb0dr ? ? ? ? ? ? ? ? pbior ? ? pb5ior pb4 ior pb3 ior pb2 ior pb1 ior pb0 ior ? ? pb5md2 pb4md2 pb3md2 pb2md2 pb1md2 ? pbcr1 ? ? ? ? ? ? ? ? ? ? ? ? pb5md1 pb5md0 pb4md1 pb4md0 pbcr2 pb3md1 pb3md0 pb2md1 pb2md0 pb1md1 pb1md0 pb0md1 pb0md0
rev. 2.00, 09/04, page 682 of 720 register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module ? ? ? ? ? ? ? pd8dr pddrl pd7dr pd6dr pd5dr pd4dr pd3dr pd2dr pd1dr pd0dr port d ? ? ? ? ? ? ? pd8ior pdiorl pd7ior pd6ior pd5ior pd4ior pd3ior pd2i or pd1ior pd0ior ? ? ? ? ? ? ? pd8md0 pdcrl1 pd7 md0 pd6 md0 pd5 md0 pd4md0 pd3 md0 pd2 md0 pd1 md0 pd0 md0 ? ? ? ? ? ? ? pd8md1 pdcrl2 pd7 md1 pd6 md1 pd5 md1 pd4md1 pd3 md1 pd2 md1 pd1 md1 pd0 md1 pe15dr pe14dr pe13dr pe12dr pe11dr pe10dr pe9dr pe8dr pedrl pe7dr pe6dr pe5dr pe4dr pe3dr pe2dr pe1dr pe0dr port e pf15dr pf14dr pf13dr pf12dr pf11dr pf10dr pf9dr pf8dr port f pfdr pf7dr pf6dr pf5dr pf4dr pf3dr pf2dr pf1dr pf0dr pe15ior pe14 ior pe13 ior pe12 ior pe11 ior pe10 ior pe9 ior pe8 ior peiorl pe7 ior pe6 ior pe5 ior pe4 ior pe3 ior pe2 ior pe1 ior pe0 ior ? ? ? ? ? ? ? ? peiorh ? ? pe21ior pe20ior pe19ior pe18ior pe17ior pe16ior port e pe15md1 pe15md0 pe14md1 pe14md0 pe13md1 pe13md0 pe12md1 pe12md0 pecrl1 pe11md1 pe11md0 pe10md1 pe10md0 pe9md1 pe9md0 pe8md1 pe8md0 pe7md1 pe7md0 pe6md1 pe6md0 pe5 md1 pe5md0 pe4md1 pe4md0 pecrl2 pe3md1 pe3md0 pe2md1 pe2md0 pe1 md1 pe1md0 pe0md1 pe0md0 ? ? ? ? pe21md1 pe21md0 pe20md1 pe20md0 pecrh pe19md1 pe19md0 pe18md1 pe18md0 pe17md1 pe17md0 pe16md1 pe16md0 ? ? ? ? ? ? ? ? pedrh ? ? pe21dr pe20dr pe19dr pe18dr pe17dr pe16dr ? ? ? ? ? ? ? ? ? ? poe3f poe2f poe1f poe0f ? ? ? pie mtu icsr1 poe3m1 poe3m0 poe2m1 poe2m0 poe1m1 poe1m0 poe0m1 poe0m0 osf ? ? ? ? ? oce oie ocsr ? ? ? ? ? ? ? ? ? poe6f poe5f poe4f ? ? ? pie icsr2 ? ? poe6m1 poe6m0 poe5m1 poe5m0 poe4m1 poe4m0 mmt ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cmstr ? ? ? ? ? ? str1 str0 ? ? ? ? ? ? ? ? cmcsr_0 cmf cmie ? ? ? ? cks1 cks0 cmcnt_0 cmt
rev. 2.00, 09/04, page 683 of 720 register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module cmcor_0 ? ? ? ? ? ? ? ? cmcsr_1 cmf cmie ? ? ? ? cks1 cks0 cmcnt_1 cmt cmcor_1 ? ? ? ? ? ? ? ? ? ? ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 addr0 ad1 ad0 ? ? ? ? ? ? a/d ad9 ad8 ad7 ad6 ad 5 ad4 ad3 ad2 addr1 ad1 ad0 ? ? ? ? ? ? ad9 ad8 ad7 ad6 ad 5 ad4 ad3 ad2 addr2 ad1 ad0 ? ? ? ? ? ? addr3 ad9 ad8 ad7 ad 6 ad5 ad4 ad3 ad2 ad1 ad0 ? ? ? ? ? ? addr4 ad9 ad8 ad7 ad 6 ad5 ad4 ad3 ad2 ad1 ad0 ? ? ? ? ? ? ad9 ad8 ad7 ad6 ad 5 ad4 ad3 ad2 addr5 ad1 ad0 ? ? ? ? ? ? ad9 ad8 ad7 ad6 ad 5 ad4 ad3 ad2 addr6 ad1 ad0 ? ? ? ? ? ? ad9 ad8 ad7 ad6 ad 5 ad4 ad3 ad2 addr7 ad1 ad0 ? ? ? ? ? ? ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 addr8 ad1 ad0 ? ? ? ? ? ? ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 addr9 ad1 ad0 ? ? ? ? ? ? ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 addr10 ad1 ad0 ? ? ? ? ? ? ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 addr11 ad1 ad0 ? ? ? ? ? ? ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 addr12 ad1 ad0 ? ? ? ? ? ? ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 addr13 ad1 ad0 ? ? ? ? ? ? ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 addr14 ad1 ad0 ? ? ? ? ? ?
rev. 2.00, 09/04, page 684 of 720 register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 addr15 ad1 ad0 ? ? ? ? ? ? a/d adcsr_0 adf adie adm1 adm0 ? ch2 ch1 ch0 adcsr_1 adf adie adm1 adm0 ? ch2 ch1 ch0 adcr_0 trge cks1 cks0 adst adcs ? ? ? adcr_1 trge cks1 cks0 adst adcs ? ? ? ? ? ? ? ? ? ? ? ? ? flmcr1 fwe swe esu psu ev pv e p flmcr2 fler ? ? ? ? ? ? ? ebr1 eb7 eb6 eb5 eb4 eb3 eb2 eb1 eb0 ebr2 ? ? ? ? eb11 eb10 eb9 eb8 flash (f-ztat only) ? ? ? ? ? ? ? ? ? ? uba31 uba30 uba29 uba28 uba27 uba26 uba25 uba24 ubarh uba23 uba22 uba21 uba20 uba19 uba18 uba17 uba16 uba15 uba14 uba13 uba12 uba11 uba10 uba9 uba8 ubarl uba7 uba6 uba5 uba4 uba3 uba2 uba1 uba0 ubm31 ubm30 ubm29 ubm28 ubm27 ubm26 ubm25 ubm24 ubamrh ubm23 ubm22 ubm21 ubm20 ubm19 ubm18 ubm17 ubm16 ubm15 ubm14 ubm13 ubm12 ubm11 ubm10 ubm9 ubm8 ubamrl ubm7 ubm6 ubm5 ubm4 ubm3 ubm2 ubm1 ubm0 ? ? ? ? ? ? ? ? ubbr cp1 cp0 id1 id0 rw1 rw0 sz1 sz0 ? ? ? ? ? ? ? ? ubcr ? ? ? ? ? cks1 cks0 ubid ubc ? ? ? ? ? ? ? ? ? ? tcsr ovf wt/ it tme ? ? cks2 cks1 cks0 tcnt rstcsr wovf rste rsts ? ? ? ? ? wdt ? ? ? ? ? ? ? ? ? ? sbycr ssby hiz ? ? ? ? ? irqel syscr ? ? ? ? ? ? audsrst rame ? ? ? ? mstp27 mstp26 mstp25 mstp24 mstcr1 ? ? ? mstp20 mstp19 mstp18 ? ? ? mstp14 mstp13 mstp12 ? ? mstp9 ? mstcr2 ? ? mstp5 mstp4 mstp3 mstp2 ? mstp0 power-down state ? ? ? ? ? ? ? ? ? ? ? mmtrwe mturwe ? ? ? ? ? bcr1 ? ? ? ? ? ? ? a0sz bsc
rev. 2.00, 09/04, page 685 of 720 register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module ? ? ? ? ? ? iw01 iw00 bcr2 ? ? ? cw0 ? ? ? sw0 ? ? ? ? ? ? ? ? wcr1 ? ? ? ? w03 w02 w01 w00 bsc ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ramer ? ? ? ? rams ram2 ram1 ram0 flash ? ? ? ? ? ? ? ? ? ? dtea dtea7 dtea6 dtea5 dtea4 dtea3 dtea2 dtea1 dtea0 dtc dteb dteb7 dteb6 dteb5 dteb4 dteb3 dteb2 dteb1 dteb0 dtec dtec7 dtec6 dtec5 dtec 4 dtec3 dtec2 dtec1 dtec0 dted dted7 dted6 dted5 dted 4 dted3 dted2 dted1 dted0 ? ? ? ? ? nmif ae swdte dtcsr dtvec7 dtvec6 dtvec5 dtvec4 dt vec3 dtvec2 dtvec1 dtvec0 dtbr dtee ? ? dtee5 ? dtee3 dtee2 dtee1 dtee0 dtef dtef7 dtef6 dtef 5 dtef4 ? dtef2 ? ? adtsr ? ? ? ? trg1s1 trg1s0 trg0s1 trg0s0 a/d ? ? ? ? ? ? ? ? ? ? mmt_tmdr ? cks2 cks1 cks0 olsn olsp md1 md0 mmt tcnr ttge cst rpro ? ? ? tgien tgiem mmt_tsr tcfd ? ? ? ? ? tgfn tgfm mmt_tcnt tpdr tpbr mmt_tddr tbru_b tgruu tgru tgrud
rev. 2.00, 09/04, page 686 of 720 register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module mmt tdcnt0 tdcnt1 tbru_f tbrv_b tgrvu tgrv tgrvd tdcnt2 tdcnt3 tbrv_f tbrw_b tgrwu tgrw tgrwd tdcnt4 tdcnt5 tbrw_f ? ? ? ? ? ? ? ? ? ? ts3 ts2 ts1 ts0 ? ? ? ? h-udi sdir ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? sdsr ? ? ? ? ? ? ? sdtrf
rev. 2.00, 09/04, page 687 of 720 register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module sddrh sddrl h-udi ? ? ? ? ? ? ? ? ? ? tst7 tst6 tst5 tst4 tst3 tst2 tst1 tst0 hcan2 mcr mcr7 ? mcr5 ? ? mcr2 mcr1 mcr0 ? ? ? ? ? ? ? ? gsr ? ? gsr5 gsr4 gsr3 gsr2 gsr1 gsr0 tseg1_3 tseg1_2 tseg1_1 tseg1_0 ? tseg2_2 tseg2_1 tseg2_0 hcan2_bcr1 ? ? sjw1 sjw0 ? ? ? bsp ? ? ? ? ? ? ? ? hcan2_bcr0 brp7 brp6 brp5 brp4 brp3 brp2 brp1 brp0 irr15 irr14 irr13 irr12 ? ? irr9 irr8 irr irr7 irr6 irr5 irr4 irr3 irr2 irr1 irr0 imr15 imr14 im r13 imr12 ? ? imr9 imr8 imr imr7 imr6 imr5 imr4 imr3 imr2 imr1 imr0 rec rec7 rec6 rec5 rec4 rec3 rec2 rec1 rec0 tec tec7 tec6 tec5 tec4 tec3 tec2 tec1 tec0 ? txpr30 txpr29 txpr28 t xpr27 txpr26 txpr25 txpr24 txpr1 txpr23 txpr22 txpr 21 txpr20 txpr19 t xpr18 txpr17 txpr16 txpr15 txpr14 txpr 13 txpr12 txpr11 t xpr10 txpr9 txpr8 txpr0 txpr7 txpr6 txpr5 txpr 4 txpr3 txpr2 txpr1 ? txcr31 txcr30 txcr29 txcr28 txcr27 txcr26 txcr25 txcr24 txcr1 txcr23 txcr22 txcr21 txcr20 txcr19 txcr18 txcr17 txcr16 txcr15 txcr14 txcr13 txcr12 txcr11 txcr10 txcr9 txcr8 txcr0 txcr7 txcr6 txcr5 txcr4 txcr3 txcr2 txcr1 ? ? txack30 txack29 t xack28 txack27 txack 26 txack25 txack24 txack1 txack23 txack22 txack 21 txack20 txack19 txac k18 txack17 txack16 txack15 txack14 txack 13 txack12 txack11 txac k10 txack9 txack8 txack0 txack7 txack6 txac k5 txack4 txack3 txack2 txack1 ? aback1 ? aback30 aback29 aback28 aback27 aback26 aback25 aback24 aback23 aback22 aback21 aback20 aback19 aback18 aback17 aback16 aback15 aback14 aback13 aback12 aback11 aback10 aback9 aback8 aback0 aback7 aback6 aback5 aback4 aback3 aback2 aback1 ? rxpr31 rxpr30 rxpr29 rxpr28 rxpr27 rxpr 26 rxpr25 rxpr24 rxpr1 rxpr23 rxpr22 rxpr21 rxpr20 rxpr19 rxpr 18 rxpr17 rxpr16 rxpr15 rxpr14 rxpr 13 rxpr12 rxpr11 r xpr10 rxpr9 rxpr8 rxpr0 rxpr7 rxpr6 rxpr5 rxpr4 rxpr3 rxpr2 rxpr1 rxpr0
rev. 2.00, 09/04, page 688 of 720 register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module rfpr31 rfpr30 rfpr29 rfpr28 rfpr 27 rfpr26 rfpr25 rfpr24 hcan2 rfpr1 rfpr23 rfpr22 rfpr21 rfpr20 rf pr19 rfpr18 rfpr17 rfpr16 rfpr15 rfpr14 rfpr13 rfpr12 rf pr11 rfpr10 rfpr9 rfpr8 rfpr0 rfpr7 rfpr6 rfpr5 rfpr4 rf pr3 rfpr2 rfpr1 rfpr0 mbimr31 mbimr30 mbimr 29 mbimr28 mbimr27 mbim r26 mbimr25 mbimr24 mbimr1 mbimr23 mbimr22 mbimr 21 mbimr20 mbimr19 mbim r18 mbimr17 mbimr16 mbimr15 mbimr14 mbimr 13 mbimr12 mbimr11 mbim r10 mbimr9 mbimr8 mbimr0 mbimr7 mbimr6 mbimr5 mbimr4 mb imr3 mbimr2 mbimr1 mbimr0 umsr31 umsr30 umsr29 umsr28 umsr27 umsr26 umsr25 umsr24 umsr1 umsr23 umsr22 umsr21 umsr20 umsr19 umsr18 umsr17 umsr16 umsr15 umsr14 umsr13 umsr12 umsr11 umsr10 umsr9 umsr8 umsr0 umsr7 umsr6 umsr5 umsr4 umsr3 umsr2 umsr1 umsr0 tcntr tcr15 tcr14 tcr13 tcr12 tcr11 tcr10 tcr9 ? tcr ? ? tpsc5 tpsc4 tpsc3 tpsc2 tpsc1 tpsc0 ? ? ? ? ? ? ? ? tsr ? ? ? ? ? tsr2 tsr1 tsr0 losr hcan2_icr0 hcan2_icr1 tcmr0 tcmr1 mb0[0] ? stdid10 stdid9 stdid8 stdid7 stdid6 stdid5 stdid4 mb0[1] stdid3 stdid2 stdid1 stdid0 rtr ide extid17 extid16 mb0[2] extid15 extid14 extid13 extid12 extid11 extid10 extid9 extid8 mb0[3] extid7 extid6 extid5 extid4 extid3 extid2 extid1 extid0 mb0[4] ccm ? nmc atx dart mbc2 mbc1 mbc0 mb0[5] ? tct ? ? dlc3 dlc2 dlc1 dlc0 mb0[6] timestamp[15:0] hcan2 mail box 0 mb0[7] msg_data_[0] mb0[8] msg_data_[1] mb0[9] msg_data_[2] mb0[10] msg_data_[3]
rev. 2.00, 09/04, page 689 of 720 register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module mb0[11] msg_data_[4] mb0[12] msg_data_[5] mb0[13] msg_data_[6] mb0[14] msg_data_[7] mb0[15] lafm0/tx-trigger time_[0] mb0[16] lafm0/tx-trigger time_[1] mb0[17] lafm1/tx-trigger time_[0] mb0[18] lafm1/tx-trigger time_[1] hcan2 mail box 0 mb1[0] to mb1[18] same bit composition as mb0[0] to mb0[18] hcan2 mail box 1 mb2[0] to mb2[18] same bit composition as mb0[0] to mb0[18] hcan2 mail box 2 mb3[0] to mb3[18] same bit composition as mb0[0] to mb0[18] hcan2 mail box 3 repeated mb29[0] to mb29[18] same bit composition as mb0[0] to mb0[18] hcan2 mail box 29 mb30[0] to mb30[18] same bit composition as mb0[0] to mb0[18] hcan2 mail box 30 mb31[0] to mb31[18] same bit composition as mb0[0] to mb0[18] hcan2 mail box 31
rev. 2.00, 09/04, page 690 of 720 a.3 register states in each operating mode register abbreviation power-on reset manual reset hardware standby software standby module standby sleep module smr_2 initialized held initializ ed initialized initialized held brr_2 initialized held initializ ed initialized initialized held scr_2 initialized held initializ ed initialized initialized held tdr_2 initialized held initializ ed initialized initialized held ssr_2 initialized held initializ ed initialized initialized held rdr_2 initialized held initializ ed initialized initialized held sdcr_2 initialized held initializ ed initialized initialized held sci (channel 2) smr_3 initialized held initializ ed initialized initialized held brr_3 initialized held initializ ed initialized initialized held scr_3 initialized held initializ ed initialized initialized held tdr_3 initialized held initializ ed initialized initialized held ssr_3 initialized held initializ ed initialized initialized held rdr_3 initialized held initializ ed initialized initialized held sdcr_3 initialized held initializ ed initialized initialized held sci (channel 3) smr_4 initialized held initializ ed initialized initialized held brr_4 initialized held initializ ed initialized initialized held scr_4 initialized held initializ ed initialized initialized held tdr_4 initialized held initializ ed initialized initialized held ssr_4 initialized held initializ ed initialized initialized held rdr_4 initialized held initializ ed initialized initialized held sdcr_4 initialized held initializ ed initialized initialized held sci (channel 4) tcr_3 initialized held initializ ed initialized initialized held tcr_4 initialized held initializ ed initialized initialized held tmdr_3 initialized held initializ ed initialized initialized held tmdr_4 initialized held initializ ed initialized initialized held tiorh_3 initialized held initia lized initialized initialized held tiorl_3 initialized held initializ ed initialized initialized held tiorh_4 initialized held initia lized initialized initialized held tiorl_4 initialized held initializ ed initialized initialized held tier_3 initialized held initializ ed initialized initialized held mtu (channels 3 and 4) tier_4 initialized held initializ ed initialized initialized held toer initialized held initializ ed initialized initialized held tocr initialized held initializ ed initialized initialized held
rev. 2.00, 09/04, page 691 of 720 register abbreviation power-on reset manual reset hardware standby software standby module standby sleep module tgcr initialized held initializ ed initialized initialized held tcnt_3 initialized held initialized initialized initialized held mtu (channels 3 and 4) tcnt_4 initialized held initialized initialized initialized held tcdr initialized held initialized initialized initialized held tddr initialized held initialized initialized initialized held tgra_3 initialized held initialized initialized initialized held tgrb_3 initialized held initialized initialized initialized held tgra_4 initialized held initialized initialized initialized held tgrb_4 initialized held initialized initialized initialized held tcnts initialized held initialized initialized initialized held tcbr initialized held initializ ed initialized initialized held tgrc_3 initialized held initializ ed initialized initialized held tgrd_3 initialized held initializ ed initialized initialized held tgrc_4 initialized held initializ ed initialized initialized held tgrd_4 initialized held initializ ed initialized initialized held tsr_3 initialized held initializ ed initialized initialized held tsr_4 initialized held initializ ed initialized initialized held tstr initialized held initialized initialized initialized held tsyr initialized held initializ ed initialized initialized held tcr_0 initialized held initializ ed initialized initialized held tmdr_0 initialized held initializ ed initialized initialized held tiorh_0 initialized held initia lized initialized initialized held tiorl_0 initialized held initializ ed initialized initialized held tier_0 initialized held initializ ed initialized initialized held tsr_0 initialized held initializ ed initialized initialized held tcnt_0 initialized held initialized initialized initialized held tgra_0 initialized held initialized initialized initialized held tgrb_0 initialized held initialized initialized initialized held tgrc_0 initialized held initializ ed initialized initialized held tgrd_0 initialized held initializ ed initialized initialized held tcr_1 initialized held initializ ed initialized initialized held tmdr_1 initialized held initializ ed initialized initialized held tior_1 initialized held initializ ed initialized initialized held tier_1 initialized held initializ ed initialized initialized held tsr_1 initialized held initializ ed initialized initialized held mtu (channel 0) tcnt_1 initialized held initialized initialized initialized held
rev. 2.00, 09/04, page 692 of 720 register abbreviation power-on reset manual reset hardware standby software standby module standby sleep module tgra_1 initialized held initialized initia lized initialized held mtu (channel 2) tgrb_1 initialized held initialized initialized initialized held tcr_2 initialized held initializ ed initialized initialized held tmdr_2 initialized held initializ ed initialized initialized held tior_2 initialized held initializ ed initialized initialized held tier_2 initialized held initializ ed initialized initialized held tsr_2 initialized held initializ ed initialized initialized held tcnt_2 initialized held initialized initialized initialized held tgra_2 initialized held initialized initialized initialized held tgrb_2 initialized held initialized initialized initialized held ipra initialized initialized initialized held ? held intc iprd initialized initialized initialized held ? held ipre initialized initialized initialized held ? held iprf initialized initialized initialized held ? held iprg initialized initialized initialized held ? held iprh initialized initialized initialized held ? held icr1 initialized initialized initialized held ? held isr initialized initialized initialized held ? held ipri initialized initialized initialized held ? held iprj initialized initialized initialized held ? held iprk initialized initialized initialized held ? held icr2 initialized initialized initialized held ? held padrl initialized held initialized held ? held port a paiorl initialized held initialized held ? held pacrl3 initialized held initialized held ? held pacrl1 initialized held initialized held ? held pacrl2 initialized held initialized held ? held pbdr initialized held initialized held ? held port b pbior initialized held initialized held ? held pbcr1 initialized held initialized held ? held pbcr2 initialized held initialized held ? held pddrl initialized held initialized held ? held port d pdiorl initialized held initialized held ? held pdcrl1 initialized held initialized held ? held pdcrl2 initialized held initialized held ? held pedrl initialized held initialized held ? held port e
rev. 2.00, 09/04, page 693 of 720 register abbreviation power-on reset manual reset hardware standby software standby module standby sleep module pfdr held held held held ? held port f peiorl initialized held initialized held ? held port e peiorh initialized held initialized held ? held pecrl1 initialized held initialized held ? held pecrl2 initialized held initialized held ? held pecrh initialized held initialized held ? held pedrh initialized held initialized held ? held icsr1 initialized held initialized held held held ocsr initialized held initialized held held held mtu icsr2 initialized held initialized held held held mmt cmstr initialized held initialized initialized initialized held cmcsr_0 initialized held initia lized initialized initialized held cmcnt_0 initialized held initia lized initialized initialized held cmcor_0 initialized held initia lized initialized initialized held cmcsr_1 initialized held initia lized initialized initialized held cmcnt_1 initialized held initia lized initialized initialized held cmt cmcor_1 initialized held initializ ed initialized initialized held addr0 initialized held initialized initialized initialized held a/d addr1 initialized held initializ ed initialized initialized held addr2 initialized held initializ ed initialized initialized held addr3 initialized held initializ ed initialized initialized held addr4 initialized held initializ ed initialized initialized held addr5 initialized held initializ ed initialized initialized held addr6 initialized held initializ ed initialized initialized held addr7 initialized held initializ ed initialized initialized held addr8 initialized held initializ ed initialized initialized held addr9 initialized held initializ ed initialized initialized held addr10 initialized held initializ ed initialized initialized held addr11 initialized held initializ ed initialized initialized held addr12 initialized held initializ ed initialized initialized held addr13 initialized held initializ ed initialized initialized held addr14 initialized held initializ ed initialized initialized held addr15 initialized held initializ ed initialized initialized held adcsr_0 initialized held initializ ed initialized initialized held adcsr_1 initialized held initializ ed initialized initialized held adcr_0 initialized held initializ ed initialized initialized held
rev. 2.00, 09/04, page 694 of 720 register abbreviation power-on reset manual reset hardware standby software standby module standby sleep module adcr_1 initialized held initialized initialized initialized held a/d flmcr1 initialized initialized init ialized initialized initialized held flmcr2 initialized initialized init ialized initialized initialized held ebr1 initialized initialized initia lized initialized initialized held ebr2 initialized initialized initia lized initialized initialized held flash ubarh initialized held initialized held initialized held ubarl initialized held initia lized held initialized held ubamrh initialized held initialized held initialized held ubamrl initialized held initialized held initialized held ubbr initialized held initia lized held initialized held ubcr initialized held initialized held initialized held ubc tcsr initialized initialized initialized initialized/ held * 1 ? held tcnt initialized initialized initialized initialized ? held rstcsr initialized/ held * 2 held initialized initialized ? held wdt sbycr initialized initialized initialized held ? held syscr initialized held initialized held ? held power-down state mstcr1 initialized held initialized held ? held mstcr2 initialized held initialized held ? held bcr1 initialized held initialized held ? held bcr2 initialized held initialized held ? held wcr1 initialized held initialized held ? held bsc ramer initialized held initialized held ? held flash dtea initialized held initialized initialized initialized held dteb initialized held initialized initialized initialized held dtec initialized held initializ ed initialized initialized held dted initialized held initializ ed initialized initialized held dtcsr initialized held initialized initialized initialized held dtbr undefined held held held held held dtc dtee initialized held initialized initialized initialized held dtef initialized held initialized initialized initialized held adtsr initialized held initialized held ? held a/d notes: 1. the bits 7 to 5 (ovf, wt/ it , and tme) in tcsr are initialized and the bits 2 to 0 (cks2 to cks0) are retained. 2. rstcsr is retained in spite of power-on reset by wdt overflow.
rev. 2.00, 09/04, page 695 of 720 register abbreviation power-on reset manual reset hardware standby software standby module standby sleep module mmt_tmdr initialized held initialized initialized initialized held tcnr initialized held initializ ed initialized initialized held mmt_tsr initialized held initia lized initialized initialized held mmt_tcnt initialized held initialized initialized initialized held mmt tpdr initialized held initialized initialized initialized held tpbr initialized held initializ ed initialized initialized held mmt_tddr initialized held initialized initialized initialized held tbru_b initialized held initialized initialized initialized held tgruu initialized held initialized initialized initialized held tgru initialized held initializ ed initialized initialized held tgrud initialized held initialized initialized initialized held tdcnt0 initialized held initialized initialized initialized held tdcnt1 initialized held initialized initialized initialized held tbru_f initialized held initializ ed initialized initialized held tbrv_b initialized held initialized initialized initialized held tgrvu initialized held initialized initialized initialized held tgrv initialized held initialized initialized initialized held tgrvd initialized held initialized initialized initialized held tdcnt2 initialized held initialized initialized initialized held tdcnt3 initialized held initialized initialized initialized held tbrv_f initialized held initialized initialized initialized held tbrw_b initialized held initialized initialized initialized held tgrwu initialized held initialized initialized initialized held tgrw initialized held initialized initialized initialized held tgrwd initialized held initialized initialized initialized held tdcnt4 initialized held initialized initialized initialized held tdcnt5 initialized held initialized initialized initialized held tbrw_f initialized held initialized initialized initialized held sdir initialized held initialized held held held sdsr initialized held initialized held held held sddrh held held held held held held sddrl held held held held held held h-udi mcr initialized initialized initia lized initialized initialized held gsr initialized initialized initia lized initialized initialized held hcan2_bcr1 initialized initialized init ialized initialized initialized held hcan2_bcr0 initialized initialized init ialized initialized initialized held hcan2
rev. 2.00, 09/04, page 696 of 720 register abbreviation power-on reset manual reset hardware standby software standby module standby sleep module irr initialized initialized initia lized initialized initialized held imr initialized initialized initia lized initialized initialized held rec initialized initialized initia lized initialized initialized held tec initialized initialized initia lized initialized initialized held txpr1 initialized initialized initia lized initialized initialized held txpr0 initialized initialized initia lized initialized initialized held txcr1 initialized initialized initia lized initialized initialized held txcr0 initialized initialized initia lized initialized initialized held txack1 initialized initialized init ialized initialized initialized held txack0 initialized initialized init ialized initialized initialized held aback1 initialized initialized initia lized initialized initialized held aback0 initialized initialized initia lized initialized initialized held hcan2 rxpr1 initialized initialized initia lized initialized initialized held rxpr0 initialized initialized initia lized initialized initialized held rfpr1 initialized initialized initia lized initialized initialized held rfpr0 initialized initialized initia lized initialized initialized held mbimr1 initialized initialized initia lized initialized initialized held mbimr0 initialized initialized initia lized initialized initialized held umsr1 initialized initialized initia lized initialized initialized held umsr0 initialized initialized initia lized initialized initialized held tcntr initialized initialized initia lized initialized initialized held tcr initialized initialized initia lized initialized initialized held tsr initialized initialized initia lized initialized initialized held losr initialized initialized initia lized initialized initialized held icr0 initialized initialized initia lized initialized initialized held hcan2_icr1 initialized initialized init ialized initialized initialized held tcmr0 initialized initialized initia lized initialized initialized held tcmr1 initialized initialized initia lized initialized initialized held mb0[0] undefined held held held held held mb0[1] undefined held held held held held mb0[2] undefined held held held held held mb0[3] undefined held held held held held mb0[4] undefined held held held held held mb0[5] undefined held held held held held mb0[6] undefined held held held held held mb0[7] undefined held held held held held
rev. 2.00, 09/04, page 697 of 720 register abbreviation power-on reset manual reset hardware standby software standby module standby sleep module mb0[8] undefined held held held held held mb0[9] undefined held held held held held mb0[10] undefined held held held held held mb0[11] undefined held held held held held mb0[12] undefined held held held held held mb0[13] undefined held held held held held mb0[14] undefined held held held held held mb0[15] undefined held held held held held mb0[16] undefined held held held held held mb0[17] undefined held held held held held mb0[18] undefined held held held held held hcan2 (values in above row repeated) mb29[0] to mb29[18] undefined held held held held held mb30[0] to mb30[18] undefined held held held held held mb31[0] to mb31[18] undefined held held held held held
rev. 2.00, 09/04, page 698 of 720 appendix b pin states the initial values differ in each mcu operating mode. for details, refer to section 17, pin function controller (pfc). table b.1 pin states (1) pin function pin state reset state power-down state power-on type pin name rom enabled rom disabled single- chip manual hardware standby software standby sleep bus release state software standby in bus right release state clock ck o z o z o o o o xtal o o l l o o l extal i i z i i i i pllcap i i i i i i i res i i i i i i i mres z i z z * 2 i i z * 2 wdtovf o * 3 o o o o o o breq z i z z i i i system control back z o z z o l l md0 to md3 i i i i i i i dbgmd i i i i i i i operation mode control fwp i i i i i i i interrupt nmi i i z i i i i irq0 to irq3 z i z z * 4 i i z * 4 irqout z o z k * 1 o o k * 1 address bus a0 to a17 o z o z z o z z data bus d0 to d7 z i/o z z i/o z z wait z i z z i z z cs0 h z o z o o z z rd h z o z o o z z bus control wrl h z o z o o z z htxd1 z o z o * 1 o o o * 1 hcan2 hrxd1 z i z z i i z mtu tclka to tclkd z i z z i i z tioc0a to tioc0d tioc1a, tioc1b tioc2a, tioc2b tioc3a, tioc3c z i/o z k * 1 i/o i/o k * 1 tioc3b, tioc3d tioc4a to tioc4d z i/o z z * 2 i/o i/o z * 2
rev. 2.00, 09/04, page 699 of 720 pin function pin state reset state power-down state power-on type pin name rom enabled rom disabled single- chip manual hardware standby software standby sleep bus release state software standby in bus right release state mmt pcio z i/o z k * 1 i/o i/o k * 1 puoa, puob pvoa, pvob pwoa, pwob z o z z * 2 o o z * 2 port control poe0 to poe6 z i z z i i z sci sck2, sck3 z i/o z z i/o i/o z sck4(pe21) z i/o z z * 2 i i z * 2 rxd2, rxd3 z i z z i i z rxd4(pe19) z i z z * 2 i i z * 2 txd2, txd3 z o z o * 1 o o o * 1 txd4(pe20) z o z o * 1 o o o * 1 an0 to an15 z i z z i i z a/d converter adtrg z i z z i i z pa0 to pa15 pb0 to pb5 pd0 to pd8 i/o port pe0 to pe8, pe10 z i/o z k * 1 i/o i/o k * 1 pe9, pe11 to pe21 z i/o z z * 2 i/o i/o z * 2 pf0 to pf15 z i z z i i z ubc ubctrg z o z o * 1 o o o * 1 [legend] i: input o: output h: high-level output l: low-level output z: high impedance k: input pins become high-impedance, and output pins retain their state. table b.2 pin states (2) pin function pin state reset state power-down state type pin name power-on ( dbgmd =h) power-on ( dbgmd =l) manual test reset hardware standby software standby sleep no connection h-udi tms z i i i z i i prohibited trst z i i i z i i prohibited tdi z i i i z i i prohibited tdo z o/z o/z z z o/z o/z o/z tck z i i i z i i prohibited
rev. 2.00, 09/04, page 700 of 720 table b.3 pin states (3) pin function pin state reset state power-down state type pin name power-on manual aud reset hardware standby software standby sleep aud module standby no connection aud audrst z h input l input z h input h input z prohibited audmd z i i z i i z prohibited audata0 to audata3 z audmd= h:i/o audmd= l:o audmd= h:i audmd= l:h z audmd= h:i/o audmd= l:o audmd= h:i/o audmd= l:o z prohibited audck z audmd= h:i audmd= l:o audmd= h:i audmd= l:h z audmd= h:i audmd= l:o audmd= h:i audmd= l:o z prohibited audsync z audmd= h:i audmd= l:o audmd= h:i audmd= l:h z audmd= h:i audmd= l:o audmd= h:i audmd= l:o z prohibited table b.4 pin states (4) pin function pin state reset state power-down state type pin name power-on ( dbgmd =h) power-on ( dbgmd =l) manual software standby sleep operating mode control asebrkak z o o o o [legend] i: input o: output h: high-level output l: low-level output z: high impedance k: input pins become high-impedance, and output pins retain their state. notes: 1. when the hiz bit in sbycr is set to 1, the output pins enter t heir high-impedance state. 2. those pins multiplexed with large-curre nt pins unconditionally enter their high- impedance state. 3. this pin operates as an input pin during a power-on reset. this pin should be pulled up to avoid malfunction. 4. this pin operates as an input pin when the irqel bit in sbycr is cleared to 0.
rev. 2.00, 09/04, page 701 of 720 table b.5 pin states (5) on-chip peripheral module 16-bit space pin name on-chip rom space on-chip ram space 8-bit space upper byte lower byte word/longword cs0 h h h h h h r h h h h h h rd h ? h h h h h r h h h h h h wrl h ? h h h h h a17 to a0 address address address address address address d7 to d0 high-z high-z high-z high-z high-z high-z [legend] r: read w: write table b.6 pin states (6) external normal space pin name 8-bit space cs0 l r l rd h h r h wrl h l a17 to a0 address d7 to d0 data [legend] r: read w: write
rev. 2.00, 09/04, page 702 of 720 appendix c product code lineup product type product code package (renesas package code) flash memory version standard pr oduct hd64f7047 qfp-100 (fp-100m) sh7047 mask rom version standard product hd6437049 qfp-100 (fp-100m)
rev. 2.00, 09/04, page 703 of 720 appendix d package dimensions renesas code jedec jeita mass (reference value) fp-100m ? conforms 1.2 g * dimension including the plating thickness base material dimension 0.10 16.0 0.2 1.0 0.5 0.1 16.0 0.2 3.05 max 75 51 50 26 1 25 76 100 14 0? ? 8? 0.5 0.08 m * 0.22 0.05 2.70 * 0.17 0.05 0.12 +0.13 ?0.12 1.0 0.20 0.04 0.15 0.04 as of july, 2002 unit: mm figure d.1 fp-100m
rev. 2.00, 09/04, page 704 of 720
rev. 2.00, 09/04, page 705 of 720 main revisions and add itions in this edition item page revisions (s ee manual for details) all sh7047 series sh7047 group precaution on handling hcan2 added. 1.4 pin functions 10 type symbol function user break controller (ubc) (flash memory version only) ubctrg ubc condition match trigger output pin. figure 3.2 the address map for the operating modes of sh7049 mask rom version 49 h'00000000 h'ffffffff h'ffffdfff h'ffffe000 h'00000000 h'00000000 h'0001ffff h'ffffffff h'ffffdfff h'ffffe000 h'ffffffff h'ffffe000 cs0 area on-chip ram reserved area mode 0 reserved area on-chip rom on-chip ram mode 2 on-chip rom on-chip ram mode 3 rom: 128 kbytes, ram: 8 kbytes 4.3.1 note on crystal resonator 55 as the resonator circuit constants will depend on the resonator and the floating capacitance of the mounting circuit, the component value should be determined in consultation with the resonator manufacturer. table 5.3 exception processing vector table 60 exception sources vector number s vector table address offset on-chip peripheral module * 2 72 : 255 h'00000120 to h'00000123 : h'000003fc to h'000003ff table 9.2 address map 137 ? on-chip rom disabled mode address space * memory h'0004 0000 to h'ffff 7fff reserved reserved table 10.10 tiorh_0 (channel 0) to table 10.25 tiorl_4 (channel 4) 164 to 179 output hold * output hold table 10.24 tiorl_4 (channel 4) 178 notes: 2. when the bfb bit in tmdr_4 is set to 1 and tgrc_4 is used as a buffer register, this setting is invalid and input capture/output compare is not generated.
rev. 2.00, 09/04, page 706 of 720 item page revisions (s ee manual for details) figure 10.34 complementary pwm mode counter operation 227 tgra_3 tcdr tddr h'0000 tcnt_4 tcnts tcnt_3 counter value figure 10.73 contention between tgr write and compare match 261 t1 t2 compare match signal write signal address p tgr address tgr write cycle figure 10.83 contention between overflow and counter clearing 271 counter clear signal tcnt input clock p tgf tcfv disabled figure 10.84 contention between tcnt write and overflow 272 t1 t2 p tcnt write cycle tcfv flag 10.9.5 usage notes 315 1. to set the poe pin as a level-detective pin, a high level signal must be firstly input to the poe pin. 2. to clear bits poe0f, poe1 f, poe2f, poe3f, and osf to 0, read registers icsr1 and ocsr. clear bits, which are read as 1, to 0, and write 1 to t he other bits in the registers.
rev. 2.00, 09/04, page 707 of 720 item page revisions (s ee manual for details) 11.1 features 317 description amended. ? switchable between watchdog timer mode and interval timer mode in watchdog timer mode ? output wdtovf signal if the counter overflows, it is possible to select whether this lsi is internally reset or not. a power-on reset or manual reset can be selected as an in internal reset. in interval timer mode ? if the counter overflows, the wdt generates an interval timer interrupt (iti). ? clears software standby mode ? selectable from eight counter input clocks. 11.3.3 reset control/status register (rstcsr) 321 rstcsr is an 8-bit readable/writ able register that controls the generation of the internal rese t signal when tcnt overflows. table 12.6 brr settings for various bit rates (clocked synchronous mode) (1) 346 operating frequency p (mhz) 4 10 logical bit rate (bit/s) n n n n 1000000 0 0 * ? ? 2500000 ? ? 0 0 * table 12.6 brr settings for various bit rates (clocked synchronous mode) (2) 347 operating frequency p (mhz) 20 22 logical bit rate (bit/s) n n n n 5000000 0 0 * ? ? figure 12.5 sample sci initialization flowchart 355 wait no yes 1-bit interval elapsed? < initialization completion> set pfc of the external pin used sck, txd, rxd [4] [5] set rie, tie, teie, and mpie bits set te and re bits in scr to 1 description [4] deleted. 12.6.1 clock 368 only in reception, the serial cl ock is continued generating until an overrun error is occurred or the re bit is cleared to 0. to execute reception in one-character units, select an external clock as a clock source.
rev. 2.00, 09/04, page 708 of 720 item page revisions (s ee manual for details) figure 12.15 sample sci initialization flowchart 369 no yes 1-bit interval elapsed? set pfc of the external pin used sck, txd, rxd [4] [5] set rie, tie, and teie bits set te and re bits in scr to 1 description [4] deleted. 13.3.2 a/d cont rol/status registers 0, 1 (adcsr_0, adcsr_1) 383 bit bit name initial value r/w description 7 adf 0 r/(w) * a/d end flag a status flag that indicates the end of a/d conversion. [setting conditions] ? when a/d conversion ends in single mode ? when a/d conversion ends on all specified channels in scan mode [clearing conditions] ? when 0 is written after reading adf = 1 ? when the dtc is activated by an adi interrupt and addr is read with the disel bit in dtmr of dtc = 0 14.2.2 compare match timer control/status register_0 and 1 (cmcsr_0, cmcsr_1) 399 bit bit name initial value r/w description 7 cmf 0 r/(w) * compare match flag this flag indicates whether or not the cmcnt and cmcor values have matched. 0: cmcnt and cmcor values have not matched 1: cmcnt and cmcor values have matched [clearing conditions] ? write 0 to cmf after reading 1 from it ? when the dtc is activated by an cmi interrupt and data is transferred with the disel bit in dtmr of dtc = 0
rev. 2.00, 09/04, page 709 of 720 item page revisions (s ee manual for details) 15.1 features 407, 408 communication speed: max. 1 mbps : hcan2 halt mode deleted ? other feature the dtc can be activated by message receive mailbox (hcan2 mailbox 0 only) ? module standby mode can be set ? read section 15.8, usage notes. 409 timer: . . . two compare match registers generate the interrupt signal to clear the counter values and set the local offset registers. 15.2 input/output pins 410 when using hcan2 pins, settings must be made in hcan2 configuration mode. 410 a renesas ha13721 compatible model is recommended. 15.3 register descriptions 410 ? transmit wait registers (txpr1, txpr0) ? transmit wait cancel registers (txcr1, txcr0) ? transmit acknowledge registers (txack1, txack0) ? abort acknowledge registers (aback1, aback0) ? receive complete registers (rxpr1, rxpr0) ? remote request registers (rfpr1, rfpr0) ? mailbox interrupt mask registers (mbimr1, mbimr0) ? unread message status registers (umsr1, umsr0) 15.3.1 master control register (mcr) 413 to 418 hcan hcan2 15.3.1 master control register (mcr) 414 bit 11: disable error counters enables/disables the error counters (tec/rec) to be functional. when this bit is enabled, the error counters (tec/rec) remain unchanged and holds the current value. when this bit is disabled, the error counters (tec/rec) function according to t he can specification. 415 bit 8: enable internal loop enables/disables the internal tx looped back to the internal rx. deleted 0: rx is fed from the rx pin
rev. 2.00, 09/04, page 710 of 720 item page revisions (s ee manual for details) 15.3.1 master control register (mcr) 416 bit 5: amended. 417 bit 1: amended. 418 bit 0: note added. 15.3.2 general status register (gsr) 419 bit 3: clearing condition amended. 15.3.5 interrupt request register (irr) 426 bit 0: initial value 0 1 15.3.8 transmit wait registers (txpr1, txpr0) 430, 431 description amended. 15.3.9 transmit wait cancel registers (txcr1, txcr0) 432, 433 description amended. 15.3.10 transmit acknowledge registers (txack1, txack0) 434, 435 description amended. 15.3.11 abort acknowledge registers (aback1, aback0) 436, 437 description amended. 15.3.12 receive complete registers (rxpr1, rxpr0) 438, 439 description amended. 15.3.13 remote request registers (rfpr1, rfpr0) 440, 441 description amended. 15.3.14 mailbox interrupt mask registers (mbimr1, mbimr0) 442, 443 description amended. 15.3.15 unread message status registers (umsr1, umsr0) 444, 445 description amended. 15.3.16 mailboxes (mb0 to mb31) 447 address register name note: shaded bits are reserved. the write value should always be 0. the read value is not guaranteed. data bus stdid[10:0] extid[15:0] ccm h'100 + n * 32 h'102 + n * 32 h'104 + n * 32 0 nmc tct 0 0 0 at x 0 dart mbc[2:0] 15 14 13 12 11 10 9 8 7 6 5 4 3 mbx[0] to [1] mbx[2] to [3] mbx[4] to [5]
rev. 2.00, 09/04, page 711 of 720 item page revisions (s ee manual for details) 15.3.16 mailboxes (mb0 to mb31) 448, 450 bits 15, 11, and 6 in the mb x[4] and mbx[5] registers: note added. 449 bits 13 in the mbx[4] and mbx[5] registers: description added. 452 bits 15 to 0 in the mbx[6] register: description amended. 453 note amended. note: * when mbc = b'001, b' 010, b'100, and b'101, these registers become a local acceptance filter mask (lafm) field. 15.3.18 timer control register (tcr) 455 to 457 description amended. 15.4.1 hardware and software resets ? software reset 460 description amended. 15.4.2 initialization after hardware reset 460 these initial settings must be made while the hcan2 is in configuration mode. deleted conf iguration mode is a state in which the gsr3 bit in gsr is set by a reset. figure 15.5 hardware reset flowchart 461 amended. figure 15.6 software reset flowchart 462 amended. table 15.5 setting range for tseg1 and tseg2 in bcr 464 note added. 15.4.2 initialization after hardware reset mailbox transmit/receive settings: 465 note added. figure 15.8 transmission flowchart by event trigger 466 imr8=1? yes no clear txack clear irr8 interrupt to cpu (sle1)
rev. 2.00, 09/04, page 712 of 720 item page revisions (s ee manual for details) figure 15.12 change of receive box id and change from receive box to transmit box 473 amended. figure 15.13 hcan2 sleep mode flowchart 474 mcr5 = 0 clear sleep mode? yes (automatic) no (manual) no sleep mode clearing method mcr7 = 1? 15.4.6 hcan2 sleep mode 475 description added. following flow is recommended to enter sleep mode. 1. set halt mode (mcr1 = 1). 2. confirm that the hcan2 is disconnected from the can bus (gsr4 = 1). 3. clear the source regist er that controls irr. 4. clear halt mode and set bits for sleep mode simultaneously (mcr1 = 0 and mcr5 = 1). figure 15.14 hcan2 halt mode flowchart 476 amended. name description ovr1 reset processing interrupt by power-on reset overload frame transmission interrupt deleted table 15.6 hcan2 interrupt sources 477
rev. 2.00, 09/04, page 713 of 720 item page revisions (s ee manual for details) 15.7 can bus interface 479 a bus transceiver ic is necessary to connect this lsi to a can bus. a renesas ha13721 transceiver ic and its compatible products are recommended. figure 15.16 high-speed interface using ha13721 479 amended. 15.8 usage notes 479 to 482 amended. 16.3.2 timer control register (tcnr) 488 the timer control register (t cnr) controls the enabling or disabling of interrupt requests, selects the enabling or disabling of register access, and selects counter operation or halting. figure 16.5 example of pwm waveform generation 498 amended. 16.7.2 notes for mmt operation 507, 508 descriptions added. 16.8.5 usage notes 513 1. to set the poe pin as a level-detective pin, a high level signal must be firstly input to the poe pin. 2. to clear bits poe4f, poe5f, and poe6f to 0, read the icsr2 register. clear bits, which are read as 1, to 0, and write 1 to the other bits in the register. 17.2 precautions for use 536 description 3 to 5 added. 19.1 features 549 ? reprogramming capability ? for details, see section 25, electrical characteristics. figure 19.10 erase/erase- verify flowchart 568 * 1 erase start swe bit 1 n 1 wait (t sswe ) s 19.13 notes on flash memory programming and erasing 571 added.
rev. 2.00, 09/04, page 714 of 720 item page revisions (s ee manual for details) section 20 mask rom 577 if you are using the on- chip rom, select mode 2 or mode 3; if you are not, select mode 0 or mode 1. the on-chip rom is allocated to addresses h' 00000000 to h'0001ffff. figure 24.1 mode transition diagram 605 notes: * nmi and irq 24.3.2 software standby mode 611 transition to software standby mode: : however, the contents of the cp u's internal registers and on- chip ram data are retained as long as the specified voltage is supplied. table 25.2 dc characteristics 620 item symbol v t+ (v ih ) v t? (v il ) schmitt trigger input voltage irq3 to irq0 , poe6 to poe0 , tclka to tclkd, tioc0a to tioc0d, tioc1a, tioc1b, tioc2a, tioc2b, tioc3a to tioc3d, tioc4a to tioc4d v t+ ?v t? table 25.6 bus timing 629 item symbol min cs delay time 1 t csd1 ? cs delay time 2 t csd2 ? wait setup time t wts 15 wait hold time t wth 0 read data access time t acc t cyc (2+n)-35 * 2 * 3 access time from read strobe t oe t cyc (1.5+n)-33 * 2 write address setup time t as 0 * 4 write address hold time t wr 5 * 5 write data hold time t wrh 0 * 4 notes: 1. see page 2 for corres pondence of the standard product, wide temperature-range product, and product model name. 2. n is the number of wait cycles. 3. at the cs assert period extension, t cyc (3 + n) - 35. 4. at the cs assert period extension, t cyc . 5. at the cs assert period extension, 5 + t cyc .
rev. 2.00, 09/04, page 715 of 720 item page revisions (s ee manual for details) figure 25.10 basic cycle (no waits) 630 t 1 v oh v ol t 2 t rsd1 t oe t rsd2 t rds t acc t rdh ck rd (read) d7 to d0 (read) figure 25.11 basic cycle (one software wait) 631 ck rd (read) d7 to d0 (read) t 1 t w t 2 v ol v oh t rsd1 t oe t rds t acc 25.3.10 port output enable (poe) timing 639 table 25.12 port output enable timing table 25.18 a/d converter characteristics 647 item min non-linear error (reference value) ? offset error (reference value) ? full-scale error (reference value) ? item symbol min typ max unit remarks reprogramming count n wec 100 * 7 10000 * 6 ? times standard product n wec ? ? 100 times wide temperat ure-range product data retained time t drp 10 * 9 ? ? years table 25.19 flash memory characteristics 648 notes 7 to 9 added.
rev. 2.00, 09/04, page 716 of 720 item page revisions (s ee manual for details) a.2 register bits 681 to 689 register bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 i/o(mmt) i/o(mmt) i/o(mmt) i/o(mmt) ? ? ? ? iprk hcan2 hcan2 hcan2 hcan2 ? ? ? ? tcsr ovf wt/ it tme ? ? cks2 cks1 cks0 ? mstp14 mstp13 mstp12 ? ? mstp9 ? mstcr2 ? ? mstp5 mstp4 mstp3 mstp2 ? mstp0 dtee ? ? dtee5 ? dtee3 dtee2 dtee1 dtee0 adtsr ? ? ? ? trg1s1 trg1s0 trg0s1 trg0s0 mmt_tmdr ? cks2 cks1 cks0 olsn olsp md1 md0 tst7 tst6 tst5 tst4 tst3 tst2 tst1 tst0 mcr mcr7 ? mcr5 ? ? mcr2 mcr1 mcr0 tseg1_3 tseg1_2 tseg1_1 tseg1_0 ? tseg2_2 tseg2_1 tseg2_0 hcan2_bcr 1 ? ? sjw1 sjw0 ? ? ? bsp imr15 imr14 imr13 imr12 ? ? imr9 imr8 imr imr7 imr6 imr5 imr4 imr3 imr2 imr1 imr0 rec rec7 rec6 rec5 rec4 rec3 rec2 rec1 rec0 tec tec7 tec6 tec5 tec4 tec3 tec2 tec1 tec0 txcr31 txcr30 txcr29 txcr28 txcr27 txcr26 txcr25 txcr24 txcr1 txcr23 txcr22 txcr21 txcr20 txcr19 txcr18 txcr17 txcr16 txcr15 txcr14 txcr13 txcr12 txcr11 txcr10 txcr9 txcr8 txcr0 txcr7 txcr6 txcr5 txcr4 txcr3 txcr2 txcr1 ? tcr15 tcr14 tcr13 tcr12 tcr11 tcr10 tcr9 ? tcr ? ? tpsc5 tpsc4 tpsc3 tpsc2 tpsc1 tpsc0 ? ? ? ? ? ? ? ? tsr ? ? ? ? ? tsr2 tsr1 tsr0 mb0[5] ? tct ? ? dlc3 dlc2 dlc1 dlc0 mb0[6] timestamp[15:0] a.3 register states in each operating mode 694 register abbrevia tion power- on reset manual reset hardware standby software standby module standby sleep module tcsr initialized initialized initialized initialized/ held * 1 ? held tcnt initialized initialized initialized initialized ? held rstcsr initialized /held * 2 held initialized initialized ? held wdt 695 to 697 mcr to tcmr1, mb0[0], and mb0[1] to mb31[18]: register states in each operating mode are amended. appendix b pin states 698 dbgmd : state in sleep is changed from o to i.
rev. 2.00, 09/04, page 717 of 720 index a/d converter ......................................... 379 a/d conversion time........................... 389 continuous scan mode........................ 387 single mode ........................................ 387 single-cycle scan mode ...................... 388 absolute maximum ratings..................... 619 address map ............................................. 48 addressing modes..................................... 23 advanced user debugger......................... 593 branch trace mode .............................. 597 ram monitor mode............................ 598 bus state controller ................................. 133 clock mode............................................... 46 clock pulse generator ............................... 51 crystal resonator................................... 52 external clock ....................................... 53 compare match timer ............................. 397 control registers ....................................... 16 global base register (gbr)................. 16 status register (sr).............................. 16 vector base register (vbr)................. 16 controller area network 2 ....................... 407 mailbox............................................... 465 re-synchronization ............................. 463 software reset ..................................... 460 time quanta ........................................ 464 data formats ............................................. 18 byte....................................................... 18 longword.............................................. 18 word ..................................................... 18 data transfer controller ........................... 109 block transfer mode............................ 125 chain transfer ..................................... 126 dtc vector table ................................ 119 dtc with interrupt activation............. 129 dtc with software activation............. 129 normal mode...................................... 123 repeat mode....................................... 124 delayed branch instructions ..................... 20 exception processing ................................ 57 exception processing vector table............. 59 address error exception processing ...... 64 general illegal instruction exception processing ............................................. 68 illegal slot exception processing ........... 68 interrupt exception processing .............. 66 manual reset.......................................... 62 power-on reset ...................................... 61 trap instruction exception processing .. 67 flash memory ......................................... 549 boot mode........................................... 560 error protection................................... 570 flash memory emula tion in ram....... 563 hardware protection............................ 569 programmer mode............................... 571 software protection............................. 570 user program mode............................. 562 general registers ....................................... 14 high-performance user debugging interface .................................................. 581 tap controller .................................... 581 i/o ports .................................................. 537 interrupt controller .................................... 73 h-udi interrupt .................................... 83 interrupt response time.......................... 91 irq interrupts ....................................... 82 nmi interrupt ........................................ 82 user break interrupt .............................. 83 vector numbers..................................... 84 vector table........................................... 84 mask rom ............................................. 577 mcu operating modes ............................. 45 motor management timer........................ 483 high-impedance state.......................... 508 multi-function timer pulse unit ............... 149 buffer operation .................................. 202 cascaded operation ............................. 206 compare match ................................... 196 free-running counters ......................... 195
rev. 2.00, 09/04, page 718 of 720 high-impedance state ......................... 306 input capture....................................... 198 phase counting mode .......................... 212 pwm mode......................................... 207 reset-synchronized pwm mode ........ 218 synchronous op eration ....................... 200 pin function controller ........................ 515 pin functions in each operating mode. 515 the functions of mu ltiplexed pins ...... 515 power-down modes ................................ 603 hardware stan dby mode ..................... 614 module standby mode ........................ 615 sleep mode ......................................... 611 software standby mode ...................... 611 processing states ....................................... 42 bus release state.................................... 43 exception processing state.................... 43 power-down state ................................. 43 program execution state........................ 43 reset state............................................. 43 ram....................................................... 579 registers aback .......................436, 660, 687, 696 adcr..........................384, 656, 684, 693 adcsr........................383, 656, 684, 693 addr..........................382, 656, 683, 693 adtsr........................386, 658, 685, 694 bcr1 ...........................138, 657, 684, 694 bcr2 ...........................139, 657, 685, 694 brr .............................340, 651, 678, 690 cmcnt.......................400, 655, 682, 693 cmcor.......................400, 655, 683, 693 cmcsr .......................399, 655, 682, 693 cmstr .......................398, 655, 682, 693 dtbr ..........................117, 658, 685, 694 dtcra .............................................. 114 dtcrb............................................... 114 dtcsr ........................116, 658, 685, 694 dtdar .............................................. 114 dte .................................... 658, 685, 694 dter.................................................. 115 dtiar................................................ 114 dtmr ................................................ 112 dtsar ............................................... 114 ebr1........................... 557, 656, 684, 694 ebr2........................... 558, 656, 684, 694 flmcr1..................... 555, 656, 684, 694 flmcr2..................... 557, 656, 684, 694 gsr............................. 418, 659, 687, 695 hcan2_bcr0 ........... 422, 659, 687, 695 hcan2_bcr1 ........... 420, 659, 687, 695 hcan2_icr0 .................... 660, 688, 696 hcan2_icr1 .................... 660, 688, 696 icr1.............................. 76, 654, 681, 692 icr2.............................. 77, 654, 681, 692 icsr1 ......................... 308, 655, 682, 693 icsr2 ......................... 509, 655, 682, 693 imr............................. 427, 659, 687, 696 ipr ................................ 80, 654, 680, 692 irr.............................. 422, 659, 687, 696 isr ................................ 79, 654, 681, 692 losr .......................... 458, 660, 688, 696 mb .............................. 445, 660, 688, 696 mbimr....................... 442, 660, 688, 696 mcr ........................... 413, 659, 687, 695 mmt_tcnt .............. 490, 658, 685, 695 mmt_tddr .............. 490, 658, 685, 695 mmt_tmdr ............. 487, 658, 685, 695 mmt_tsr ................. 489, 658, 685, 695 mstcr....................... 609, 657, 684, 694 ocsr.......................... 311, 655, 682, 693 pacrl ....................... 525, 654, 681, 692 padrl ....................... 538, 654, 681, 692 paiorl...................... 525, 654, 681, 692 pbcr .......................... 529, 655, 681, 692 pbdr.......................... 539, 654, 681, 692 pbior......................... 529, 655, 681, 692 pdcrl ....................... 531, 655, 682, 692 pddrl ....................... 541, 655, 682, 692 pdiorl...................... 530, 655, 682, 692 pecrh ....................... 533, 655, 682, 693 pecrl........................ 533, 655, 682, 693 pedrh ....................... 544, 655, 682, 693 pedrl........................ 544, 655, 682, 692 peiorh...................... 532, 655, 682, 693 peiorl ...................... 532, 655, 682, 693
rev. 2.00, 09/04, page 719 of 720 pfdr .......................... 546, 655, 682, 693 ramer...............140, 558, 657, 685, 694 rdr............................ 333, 651, 678, 690 rec ............................ 429, 659, 687, 696 rfpr .......................... 440, 660, 688, 696 rsr..................................................... 333 rstcsr ..................... 321, 657, 684, 694 rxpr.......................... 438, 660, 687, 696 sbycr ....................... 607, 657, 684, 694 scr............................. 335, 651, 678, 690 sdcr.......................... 340, 651, 678, 690 sddr ......................... 586, 659, 687, 695 sdir ........................... 584, 659, 686, 695 sdsr .......................... 585, 659, 686, 695 smr............................ 334, 651, 678, 690 ssr ............................. 337, 651, 678, 690 syscr ....................... 608, 657, 684, 694 tbr ............................ 490, 658, 685, 695 tcbr.......................... 193, 652, 679, 691 tcdr ......................... 193, 652, 679, 691 tcmr0............................... 660, 688, 696 tcmr1............................... 660, 688, 696 tcnr ......................... 488, 658, 685, 695 tcnt......................... 185, 319, 652, 657, 679, 684, 691, 694 tcntr ....................... 454, 660, 688, 696 tcnts ....................... 192, 652, 679, 691 tcr ........................... 156, 455, 652, 660, 678, 688, 690, 696 tcsr .......................... 319, 657, 684, 694 tdcnt....................... 490, 658, 686, 695 tddr ......................... 192, 652, 679, 691 tdr ............................ 333, 651, 678, 690 tec............................. 429, 659, 687, 696 tgcr ......................... 191, 652, 679, 691 tgr ........................... 185, 490, 652, 658, 679, 685, 691, 695 tier ........................... 180, 652, 678, 690 tior ........................... 162, 652, 678, 690 tmdr......................... 160, 652, 678, 690 tocr.......................... 189, 652, 679, 690 toer .......................... 188, 652, 678, 690 tpbr .......................... 490, 658, 685, 695 tpdr .......................... 491, 658, 685, 695 tsr ............................ 182, 333, 457, 652, 660, 679, 688, 691, 696 tstr........................... 186, 653, 679, 691 tsyr .......................... 187, 653, 679, 691 txack....................... 434, 660, 687, 696 txcr.......................... 432, 660, 687, 696 txpr .......................... 430, 660, 687, 696 ubamr........................ 98, 657, 684, 694 ubar ........................... 97, 657, 684, 694 ubbr............................ 98, 657, 684, 694 ubcr.......................... 100, 657, 684, 694 umsr ................................. 660, 688, 696 wcr1 ......................... 140, 657, 685, 694 risc ......................................................... 20 serial communicati on interface .............. 329 asynchronous serial communication .. 351 clocked synchronous communication 368 multiprocessor communication function ............................................... 362 system registers ........................................ 17 multiply-and-accumulate registers (mac) .................................... 17 procedure register (pr)......................... 17 program counter (pc) ........................... 17 user break controller................................. 95 watchdog timer....................................... 317 interval timer mode............................. 323 reading from tcnt, tcsr, and rstcsr.............................................. 327 watchdog timer mode......................... 322 writing to rs tcsr ............................ 326 writing to tcnt and tcsr............... 325
rev. 2.00, 09/04, page 720 of 720
renesas 32-bit risc microcomputer hardware manual sh-2 sh7047 group publication date: rev.1.00, apr 24, 2003 rev.2.00, sep 16, 2004 published by: sales strategic planning div. renesas technology corp. edited by: technical documentation & information department renesas kodaira semiconductor co., ltd. ? 2004. renesas technology corp., all rights reserved. printed in japan.
sales strategic planning div. nippon bldg., 2-6-2, ohte-machi, chiyoda-ku, tokyo 100-0004, japan http://www.renesas.com refer to " http://www.renesas.com/en/network " for the latest and detailed information. renesas technology america, inc. 450 holger way, san jose, ca 95134-1368, u.s.a tel: <1> (408) 382-7500, fax: <1> (408) 382-7501 renesas technology europe limited dukes meadow, millboard road, bourne end, buckinghamshire, sl8 5fh, u.k. tel: <44> (1628) 585-100, fax: <44> (1628) 585-900 renesas technology hong kong ltd. 7th floor, north tower, world finance centre, harbour city, 1 canton road, tsimshatsui, kowloon, hong kong tel: <852> 2265-6688, fax: <852> 2730-6071 renesas technology taiwan co., ltd. 10th floor, no.99, fushing north road, taipei, taiwan tel: <886> (2) 2715-2888, fax: <886> (2) 2713-2999 renesas technology (shanghai) co., ltd. unit2607 ruijing building, no.205 maoming road (s), shanghai 200020, china tel: <86> (21) 6472-1001, fax: <86> (21) 6415-2952 renesas technology singapore pte. ltd. 1 harbour front avenue, #06-10, keppel bay tower, singapore 098632 tel: <65> 6213-0200, fax: <65> 6278-8001 renesas sales offices colophon 2.0

sh-2 sh7047 group rej09b0020-0200z hardware manual 1753, shimonumabe, nakahara-ku, kawasaki-shi, kanagawa 211-8668 japan


▲Up To Search▲   

 
Price & Availability of HD64F7047F50

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X